Use timers to avoid Vim patch 8.1.1756

Closes https://github.com/tpope/vim-fugitive/issues/1329
This commit is contained in:
Tim Pope
2019-12-06 14:29:26 -05:00
parent e1ab8fff09
commit b48a572475

View File

@@ -3489,7 +3489,7 @@ function! s:FinishCommit() abort
call setbufvar(buf, 'fugitive_commit_arguments', [])
if getbufvar(buf, 'fugitive_commit_rebase')
call setbufvar(buf, 'fugitive_commit_rebase', 0)
let s:rebase_continue = s:Dir(buf)
let s:rebase_continue = [s:Dir(buf), 0]
endif
return s:CommitSubcommand(-1, -1, 0, 0, '', args, s:Dir(buf))
endif
@@ -3758,18 +3758,27 @@ function! s:PullSubcommand(line1, line2, range, bang, mods, args) abort
return s:MergeRebase('pull', a:bang, a:mods, a:args)
endfunction
function! s:RebaseContinue(arg) abort
let [dir, edit_todo] = a:arg
exe s:MergeRebase('rebase', 0, '', [edit_todo && getfsize(fugitive#Find('.git/rebase-merge/git-rebase-todo', dir)) <= 0 ? '--abort' : '--continue'], dir)
endfunction
augroup fugitive_merge
autocmd!
autocmd VimLeavePre,BufDelete git-rebase-todo
\ if getbufvar(+expand('<abuf>'), '&bufhidden') ==# 'wipe' |
\ call s:RebaseClean(expand('<afile>')) |
\ if getfsize(FugitiveFind('.git/rebase-merge/done', +expand('<abuf>'))) == 0 |
\ let s:rebase_continue = FugitiveGitDir(+expand('<abuf>')) |
\ let s:rebase_continue = [FugitiveGitDir(+expand('<abuf>')), 1] |
\ endif |
\ endif
autocmd BufEnter * nested
\ if exists('s:rebase_continue') |
\ exe s:MergeRebase('rebase', 0, '', [getfsize(fugitive#Find('.git/rebase-merge/git-rebase-todo', s:rebase_continue)) >= 0 + (expand('<afile>:t') ==# 'git-rebase-todo') ? '--continue' : '--abort'], remove(s:, 'rebase_continue')) |
\ if has('timer') |
\ call timer_start(0, function('s:RebaseContinue', [remove(s:, 'rebase_continue')])) |
\ else |
\ call s:RebaseContinue(remove(s:, 'rebase_continue')) |
\ endif |
\ endif
augroup END