From b48a572475488572b738bf9c49726d63f7fa5e34 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 6 Dec 2019 14:29:26 -0500 Subject: [PATCH] Use timers to avoid Vim patch 8.1.1756 Closes https://github.com/tpope/vim-fugitive/issues/1329 --- autoload/fugitive.vim | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 2435580..b33f269 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -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(''), '&bufhidden') ==# 'wipe' | \ call s:RebaseClean(expand('')) | \ if getfsize(FugitiveFind('.git/rebase-merge/done', +expand(''))) == 0 | - \ let s:rebase_continue = FugitiveGitDir(+expand('')) | + \ let s:rebase_continue = [FugitiveGitDir(+expand('')), 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(':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