Use cwd to find Git repository for terminal window

Closes https://github.com/tpope/vim-fugitive/issues/1520
This commit is contained in:
Tim Pope
2021-07-05 16:41:39 -04:00
parent d11c90ad66
commit 0ec3bb2bdd

View File

@@ -18,7 +18,7 @@ function! FugitiveGitDir(...) abort
return g:fugitive_event
endif
let dir = get(b:, 'git_dir', '')
if empty(dir) && (empty(bufname('')) || &buftype =~# '^\%(nofile\|acwrite\|quickfix\|prompt\)$')
if empty(dir) && (empty(bufname('')) || &buftype =~# '^\%(nofile\|acwrite\|quickfix\|terminal\|prompt\)$')
return FugitiveExtractGitDir(getcwd())
elseif (!exists('b:git_dir') || b:git_dir =~# s:bad_git_dir) && empty(&buftype)
let b:git_dir = FugitiveExtractGitDir(expand('%:p'))