From 8c4350503721a1c33df7978626797e830164bafa Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 29 May 2018 23:03:24 -0400 Subject: [PATCH] Provide :Grebase (no --interactive) --- doc/fugitive.txt | 4 ++++ plugin/fugitive.vim | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/fugitive.txt b/doc/fugitive.txt index 4818472..1c02ff5 100644 --- a/doc/fugitive.txt +++ b/doc/fugitive.txt @@ -87,6 +87,10 @@ that are part of Git repositories). *fugitive-:Gpull* :Gpull [args] Like |:Gmerge|, but for git-pull. + *fugitive-:Grebase* +:Grebase [args] Like |:Gmerge|, but for git-rebase. Interactive + rebase not suppported. + *fugitive-:Gpush* :Gpush [args] Invoke git-push, load the results into the |quickfix| list, and invoke |:cwindow| to reveal any errors. diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index f038972..3a49e1e 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -1213,6 +1213,8 @@ endfunction call s:command("-nargs=? -bang -complete=custom,s:RevisionComplete Gmerge " . \ "execute s:Merge('merge', 0, )") +call s:command("-nargs=? -bang -complete=custom,s:RevisionComplete Grebase " . + \ "execute s:Merge('rebase', 0, )") call s:command("-nargs=? -bang -complete=custom,s:RemoteComplete Gpull " . \ "execute s:Merge('pull --progress', 0, )") @@ -1253,6 +1255,9 @@ let s:common_efm = '' \ . '%-G%.%#%\r%.%\+' function! s:Merge(cmd, bang, args) abort + if a:cmd =~# '^rebase' && ' '.a:args =~# ' -i\| --interactive\| --edit-todo' + return 'echoerr "git rebase --interactive not supported"' + endif let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' let cwd = getcwd() let [mp, efm] = [&l:mp, &l:efm] @@ -1284,7 +1289,7 @@ function! s:Merge(cmd, bang, args) abort let &l:makeprg = g:fugitive_git_executable.' diff-files --name-status --diff-filter=U' else let &l:makeprg = s:sub(s:git_command() . ' ' . a:cmd . - \ (a:args =~# ' \%(--no-edit\|--abort\|-m\)\>' ? '' : ' --edit') . + \ (a:args =~# ' \%(--no-edit\|--abort\|-m\)\>' || a:cmd =~# '^rebase' ? '' : ' --edit') . \ ' ' . a:args, ' *$', '') endif if !empty($GIT_EDITOR) || has('win32')