Look for "fugitive_dir" as dictionary key

Work trees and submodules have two things that could be called the Git
dir: the directory itself, and the ".git" at the root of the work tree.
Introduce "fugitive_dir" as our name for the one we consider canonical.
This commit is contained in:
Tim Pope
2022-06-20 20:16:08 -04:00
parent 8b39d29d94
commit aafbdf84cd
2 changed files with 14 additions and 13 deletions

View File

@@ -39,7 +39,7 @@ function! FugitiveGitDir(...) abort
elseif type(a:1) == type('')
return substitute(s:Slash(a:1), '/$', '', '')
elseif type(a:1) == type({})
return get(a:1, 'git_dir', '')
return get(a:1, 'fugitive_dir', get(a:1, 'git_dir', ''))
else
return ''
endif
@@ -423,7 +423,7 @@ endfunction
function! FugitiveExtractGitDir(path) abort
if type(a:path) ==# type({})
return get(a:path, 'git_dir', '')
return get(a:1, 'fugitive_dir', get(a:1, 'git_dir', ''))
elseif type(a:path) == type(0)
let path = s:Slash(a:path > 0 ? bufname(a:path) : bufname(''))
else