Restore .git_dir on fugitive#repo()

This will enable functions like FugitiveFind() to use fugitive#repo() as
the optional second parameter, which should make transitioning to the
new API a bit easier to do incrementally.
This commit is contained in:
Tim Pope
2022-06-17 13:15:29 -04:00
parent 9fadd7a778
commit abe29d4891

View File

@@ -1553,7 +1553,11 @@ endfunction
let s:repo_prototype = {}
function! fugitive#repo(...) abort
return copy(s:repo_prototype)
let dir = a:0 ? s:GitDir(a:1) : (len(s:GitDir()) ? s:GitDir() : FugitiveExtractGitDir(expand('%:p')))
if dir !=# ''
return extend({'git_dir': dir, 'fugitive_dir': dir}, s:repo_prototype, 'keep')
endif
throw 'fugitive: not a Git repository'
endfunction
function! s:repo_dir(...) dict abort