mirror of
https://github.com/tpope/vim-fugitive.git
synced 2026-10-03 17:03:53 +08:00
Don't fall back to pwd for Git dir of blank filename
In particular, this fixes `FugitiveFind(..., '')` to respect the empty Git dir argument rather than falling back to detection on the current working directory. Which in turn fixes :Gstatus using the current working directory when called from a buffer that does not belong to a repository. References https://github.com/tpope/vim-fugitive/issues/1408
This commit is contained in:
1 parent
eed46c1f24
commit
67efbf66e0
1 file changed
+2
@@ -181,6 +181,8 @@ function! FugitiveExtractGitDir(path) abort
|
||||
let path = s:Slash(a:path)
|
||||
if path =~# '^fugitive:'
|
||||
return matchstr(path, '\C^fugitive:\%(//\)\=\zs.\{-\}\ze\%(//\|::\|$\)')
|
||||
elseif empty(path)
|
||||
return ''
|
||||
elseif isdirectory(path)
|
||||
let path = fnamemodify(path, ':p:s?/$??')
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user