Don't reload status on non-Fugitive ShellCmdPost

This commit is contained in:
Tim Pope
2019-09-27 09:00:26 -04:00
parent 540d8024c2
commit fee14c149c

View File

@@ -2138,7 +2138,9 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort
if has('nvim') && executable('env') if has('nvim') && executable('env')
let pre .= 'env GIT_TERMINAL_PROMPT=0 ' let pre .= 'env GIT_TERMINAL_PROMPT=0 '
endif endif
return 'exe ' . string('!' . escape(pre . s:UserCommand(dir, args), '!#%')) . after return 'exe ' . string('noautocmd !' . escape(pre . s:UserCommand(dir, args), '!#%')) .
\ '|call fugitive#ReloadStatus(' . string(dir) . ', 1)' .
\ after
endfunction endfunction
let s:exec_paths = {} let s:exec_paths = {}
@@ -2414,14 +2416,27 @@ function! s:CanAutoReloadStatus() abort
return get(g:, 'fugitive_autoreload_status', !has('win32')) return get(g:, 'fugitive_autoreload_status', !has('win32'))
endfunction endfunction
function! fugitive#EfmDir(...) abort
let dir = matchstr(a:0 ? a:1 : &errorformat, '\c,%\\&\%(git\|fugitive\)_\=dir=\zs\%(\\.\|[^,]\)*')
let dir = substitute(dir, '%%', '%', 'g')
let dir = substitute(dir, '\\\ze[\,]', '', 'g')
return dir
endfunction
augroup fugitive_status augroup fugitive_status
autocmd! autocmd!
autocmd BufWritePost * call fugitive#ReloadStatus(-1, 0) autocmd BufWritePost * call fugitive#ReloadStatus(-1, 0)
autocmd ShellCmdPost * nested call fugitive#ReloadStatus() autocmd ShellCmdPost,ShellFilterPost * nested call fugitive#ReloadStatus(-2, 0)
autocmd BufDelete * nested autocmd BufDelete * nested
\ if getbufvar(+expand('<abuf>'), 'buftype') == 'terminal' | \ if getbufvar(+expand('<abuf>'), 'buftype') ==# 'terminal' |
\ call fugitive#ReloadStatus() | \ if !empty(FugitiveGitDir(+expand('<abuf>'))) |
\ call fugitive#ReloadStatus(+expand('<abuf>'), 1) |
\ else |
\ call fugitive#ReloadStatus(-2, 0) |
\ endif |
\ endif \ endif
autocmd QuickFixCmdPost make,lmake,[cl]file,[cl]getfile nested
\ call fugitive#ReloadStatus(fugitive#EfmDir(), 1)
if !has('win32') if !has('win32')
autocmd FocusGained * call fugitive#ReloadStatus(-2, 0) autocmd FocusGained * call fugitive#ReloadStatus(-2, 0)
endif endif
@@ -4242,7 +4257,8 @@ function! s:Dispatch(bang, cmd, args) abort
let [mp, efm, cc] = [&l:mp, &l:efm, get(b:, 'current_compiler', '')] let [mp, efm, cc] = [&l:mp, &l:efm, get(b:, 'current_compiler', '')]
try try
let b:current_compiler = 'git' let b:current_compiler = 'git'
let &l:errorformat = s:common_efm let &l:errorformat = s:common_efm .
\ ',%\&git_dir=' . escape(substitute(dir, '%', '%%', 'g'), '\,')
let &l:makeprg = s:UserCommand(dir, s:AskPassArgs(dir) + [a:cmd] + a:args) let &l:makeprg = s:UserCommand(dir, s:AskPassArgs(dir) + [a:cmd] + a:args)
if exists(':Make') == 2 if exists(':Make') == 2
Make Make