mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-13 05:43:52 -05:00
Set b:git_dir early in BufReadCmd
We call :setlocal filetype=git before manually triggering BufReadPost, which means that the FileType events in the plugin file containing len(FugitiveGitDir()) checks all short circuited. This wasn't noticed before because: * They're mostly nonessential, save for fugitive#MapJumps() which we also explicitly invoke in BufReadCmd. * If :filetype on is invoked *after* Fugitive is loaded, then it will set the filetype a second time *after* we've properly set b:git_dir. (This was the case on my machine, except when reloading the plugin redefined the autocommands and thus reversed the order.) The load order issue is also relevant to plain file buffers. This will require an additional fix.
This commit is contained in:
@@ -2108,6 +2108,7 @@ function! fugitive#BufReadCmd(...) abort
|
|||||||
if empty(dir)
|
if empty(dir)
|
||||||
return 'echo "Invalid Fugitive URL"'
|
return 'echo "Invalid Fugitive URL"'
|
||||||
endif
|
endif
|
||||||
|
let b:git_dir = dir
|
||||||
if rev =~# '^:\d$'
|
if rev =~# '^:\d$'
|
||||||
let b:fugitive_type = 'stage'
|
let b:fugitive_type = 'stage'
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user