Trigger User FugitiveChanged on events that change repository

Note that in the context of this event, Fugitive functions will use the
changed repository, which might not be the same as the current buffer's
repository.  Pass bufnr() as the optional dir argument to force the
current buffer.

Closes https://github.com/tpope/vim-fugitive/issues/458
This commit is contained in:
Tim Pope committed 2019-09-27 09:30:40 -04:00
1 parent fee14c149c
commit ab26e9fdb3
2 files changed
+33 -10

No files matched your search

+3
View File
@@ -10,6 +10,9 @@ let g:loaded_fugitive = 1
function! FugitiveGitDir(...) abort
if !a:0 || type(a:1) == type(0) && a:1 < 0
if exists('g:fugitive_event')
return g:fugitive_event
endif
let dir = get(b:, 'git_dir', '')
if empty(dir) && (empty(bufname('')) || &buftype =~# '^\%(nofile\|acwrite\|quickfix\|prompt\)$')
return FugitiveExtractGitDir(getcwd())