Add mods support to :Gmerge

This commit is contained in:
Tim Pope 2018-12-26 16:23:33 -05:00
parent de1f8b5a20
commit a1f9596d2d

View File

@ -2285,11 +2285,11 @@ endfunction
" Section: :Gmerge, :Grebase, :Gpull
call s:command("-nargs=? -bang -complete=custom,s:RevisionComplete Gmerge " .
\ "execute s:Merge('merge', <bang>0, <q-args>)")
\ "execute s:Merge('merge', <bang>0, '<mods>', <q-args>)")
call s:command("-nargs=? -bang -complete=custom,s:RevisionComplete Grebase " .
\ "execute s:Merge('rebase', <bang>0, <q-args>)")
\ "execute s:Merge('rebase', <bang>0, '<mods>', <q-args>)")
call s:command("-nargs=? -bang -complete=custom,s:RemoteComplete Gpull " .
\ "execute s:Merge('pull --progress', <bang>0, <q-args>)")
\ "execute s:Merge('pull --progress', <bang>0, '<mods>', <q-args>)")
function! s:RevisionComplete(A, L, P) abort
return s:TreeChomp('rev-parse', '--symbolic', '--branches', '--tags', '--remotes')
@ -2327,7 +2327,8 @@ let s:common_efm = ''
\ . '%-G%.%#%\e[K%.%#,'
\ . '%-G%.%#%\r%.%\+'
function! s:Merge(cmd, bang, args) abort
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'
return 'echoerr "git rebase --interactive not supported"'
endif
@ -2385,7 +2386,7 @@ function! s:Merge(cmd, bang, args) abort
if empty(filter(getqflist(),'v:val.valid'))
if !had_merge_msg && filereadable(b:git_dir . '/MERGE_MSG')
cclose
return 'Gcommit --no-status -n -t '.s:shellesc(b:git_dir . '/MERGE_MSG')
return mods . 'Gcommit --no-status -n -t '.s:shellesc(b:git_dir . '/MERGE_MSG')
endif
endif
let qflist = getqflist()