mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-14 06:13:51 -05: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:
@@ -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