mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-15 06:43:51 -05:00
Pass absolute paths through FugitiveGenerate() unchanged
This is designed to exclude traditional paths, URLs, and also Vim constructs like zipfile:c:\foo.zip::file.
This commit is contained in:
@@ -337,8 +337,8 @@ function! s:repo_translate(spec, ...) dict abort
|
|||||||
let f = dir . s:sub(rev, '^/=\.git', '')
|
let f = dir . s:sub(rev, '^/=\.git', '')
|
||||||
elseif empty(rev) || rev ==# '/.'
|
elseif empty(rev) || rev ==# '/.'
|
||||||
return self.tree()
|
return self.tree()
|
||||||
elseif rev =~# '^/'
|
elseif rev =~# '^\.\=/'
|
||||||
let f = self.tree(rev)
|
let f = self.tree(substitute(rev, '^\.', '', ''))
|
||||||
elseif rev =~# '^:[0-3]:/\@!'
|
elseif rev =~# '^:[0-3]:/\@!'
|
||||||
let f = 'fugitive://' . dir . '//' . rev[1] . '/' . rev[3:-1]
|
let f = 'fugitive://' . dir . '//' . rev[1] . '/' . rev[3:-1]
|
||||||
elseif rev ==# ':'
|
elseif rev ==# ':'
|
||||||
@@ -532,8 +532,10 @@ function! fugitive#Path(url, ...) abort
|
|||||||
let file = '/.git'.url[strlen(dir) : -1]
|
let file = '/.git'.url[strlen(dir) : -1]
|
||||||
elseif len(tree) && s:cpath(url[0 : len(tree)]) ==# s:cpath(tree . '/')
|
elseif len(tree) && s:cpath(url[0 : len(tree)]) ==# s:cpath(tree . '/')
|
||||||
let file = url[len(tree) : -1]
|
let file = url[len(tree) : -1]
|
||||||
|
elseif s:cpath(url) ==# s:cpath(tree)
|
||||||
|
let file = '/'
|
||||||
endif
|
endif
|
||||||
if empty(file) && a:1 ==# ''
|
if empty(file) && a:1 =~# '^\%([.:]\=/\)\=$'
|
||||||
return s:shellslash(fugitive#Real(a:url))
|
return s:shellslash(fugitive#Real(a:url))
|
||||||
endif
|
endif
|
||||||
return substitute(file, '^/', a:1, '')
|
return substitute(file, '^/', a:1, '')
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ refs/heads/x .git/refs/heads/x
|
|||||||
@ The commit referenced by @ aka HEAD
|
@ The commit referenced by @ aka HEAD
|
||||||
master^ The parent of the commit referenced by master
|
master^ The parent of the commit referenced by master
|
||||||
master: The tree referenced by master
|
master: The tree referenced by master
|
||||||
/master The file named master in the work tree
|
./master The file named master in the work tree
|
||||||
Makefile The file named Makefile in the work tree
|
Makefile The file named Makefile in the work tree
|
||||||
@^:Makefile The file named Makefile in the parent of HEAD
|
@^:Makefile The file named Makefile in the parent of HEAD
|
||||||
:Makefile The file named Makefile in the index (writable)
|
:Makefile The file named Makefile in the index (writable)
|
||||||
@@ -335,7 +335,6 @@ Makefile The file named Makefile in the work tree
|
|||||||
:1 The current file's common ancestor during a conflict
|
:1 The current file's common ancestor during a conflict
|
||||||
:2 The current file in the target branch during a conflict
|
:2 The current file in the target branch during a conflict
|
||||||
:3 The current file in the merged branch during a conflict
|
:3 The current file in the merged branch during a conflict
|
||||||
:/foo The most recent commit with "foo" in the message
|
|
||||||
|
|
||||||
STATUSLINE *fugitive-statusline*
|
STATUSLINE *fugitive-statusline*
|
||||||
|
|
||||||
|
|||||||
@@ -159,6 +159,9 @@ function! FugitivePath(...) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! FugitiveGenerate(...) abort
|
function! FugitiveGenerate(...) abort
|
||||||
|
if a:0 && s:shellslash(a:0) =~# '^\%(\a\a\+:\)\=\%(a:\)\=/\|^[~$]'
|
||||||
|
return a:1
|
||||||
|
endif
|
||||||
return fugitive#repo(a:0 > 1 ? a:2 : get(b:, 'git_dir', '')).translate(a:0 ? a:1 : '', 1)
|
return fugitive#repo(a:0 > 1 ? a:2 : get(b:, 'git_dir', '')).translate(a:0 ? a:1 : '', 1)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user