Give precedence to absolute paths over pseudo-relative

I was planning on phasing out support for /path to access a file in the
root of the repo slowly, but life gets simpler if we can count on
absolute paths always working as expected.
This commit is contained in:
Tim Pope
2018-08-10 15:58:09 -04:00
parent 2ca0765dc4
commit 7ea21ca9ac

View File

@@ -543,7 +543,7 @@ function! s:Generate(rev, ...) abort
let dir = a:0 ? a:1 : get(b:, 'git_dir', '')
let tree = s:Tree(dir)
let object = a:rev
if a:rev =~# '^/' && len(tree) && (getftime(tree . a:rev) >= 0 || getftime(a:rev) < 0) || a:rev =~# '^/\.git\%(/\|$\)'
if a:rev =~# '^/' && len(tree) && getftime(tree . a:rev) >= 0 && getftime(a:rev) < 0 || a:rev =~# '^/\.git\%(/\|$\)'
let object = '.' . object
endif
return fugitive#Route(object, dir)