Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Grebase --continue/--edit-todo editor invocation #1139

Merged
merged 2 commits into from
Dec 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions autoload/fugitive.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2308,6 +2308,13 @@ function! s:RemoteComplete(A, L, P) abort
return join(matches, "\n")
endfunction

function! s:HasRebaseCommitCmd() abort
if !filereadable(b:git_dir . '/rebase-merge/amend') || !filereadable(b:git_dir . '/rebase-merge/done')
return 0
endif
return get(readfile(b:git_dir . '/rebase-merge/done'), -1, '') =~# '^[^e]'
endfunction

function! fugitive#Cwindow() abort
if &buftype == 'quickfix'
cwindow
Expand All @@ -2329,7 +2336,7 @@ let s:common_efm = ''

function! s:Merge(cmd, bang, mods, args) abort
let mods = substitute(a:mods, '\C<mods>', '', '') . ' '
if a:cmd =~# '^rebase' && ' '.a:args =~# ' -i\| --interactive\| --edit-todo'
if a:cmd =~# '^rebase' && ' '.a:args =~# ' -i\| --interactive'
return 'echoerr "git rebase --interactive not supported"'
endif
let [mp, efm] = [&l:mp, &l:efm]
Expand All @@ -2345,6 +2352,7 @@ function! s:Merge(cmd, bang, mods, args) abort
\ . '%+ECannot %.%#: Your index contains uncommitted changes.,'
\ . '%+EThere is no tracking information for the current branch.,'
\ . '%+EYou are not currently on a branch. Please specify which,'
\ . '%+I%.%#git rebase --continue,'
\ . 'CONFLICT (%m): %f deleted in %.%#,'
\ . 'CONFLICT (%m): Merge conflict in %f,'
\ . 'CONFLICT (%m): Rename \"%f\"->%.%#,'
Expand Down Expand Up @@ -2383,10 +2391,15 @@ function! s:Merge(cmd, bang, mods, args) abort
execute cdback
endtry
call fugitive#ReloadStatus()
if empty(filter(getqflist(),'v:val.valid'))
if empty(filter(getqflist(),'v:val.valid && v:val.type !=# "I"'))
if !had_merge_msg && filereadable(b:git_dir . '/MERGE_MSG')
cclose
return mods . 'Gcommit --no-status -n -t '.s:shellesc(b:git_dir . '/MERGE_MSG')
elseif a:cmd =~# '^rebase' && ' '.a:args =~# ' --continue' && s:HasRebaseCommitCmd()
cclose
return mods . 'Gcommit --amend'
elseif a:cmd =~# '^rebase' && ' '.a:args =~# ' --edit-todo'
return mods . 'Gsplit ' . s:fnameescape(b:git_dir . '/rebase-merge/git-rebase-todo') . ' | setlocal bufhidden=wipe nobuflisted'
endif
endif
let qflist = getqflist()
Expand Down