From d7172882b758ef58e2e8e2000541bb38d88d3707 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 6 Aug 2019 19:57:27 -0400 Subject: [PATCH] Add default core.askPass to :Gpull --- autoload/fugitive.vim | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 1ca08a5..5fbe01c 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -3482,8 +3482,22 @@ function! s:MergeRebase(cmd, bang, mods, args, ...) abort endif endif endif - let [mp, efm] = [&l:mp, &l:efm] let had_merge_msg = filereadable(fugitive#Find('.git/MERGE_MSG', dir)) + let argv = s:UserCommandList(dir) + if a:cmd ==# 'pull' + let argv += s:AskPassArgs(dir) + ['pull', '--progress'] + else + call add(argv, a:cmd) + endif + if !s:HasOpt(args, '--no-edit', '--abort', '-m') && a:cmd !=# 'rebase' + call add(argv, '--edit') + endif + if a:cmd ==# 'rebase' && s:HasOpt(args, '--autosquash') && !s:HasOpt(args, '--interactive', '-i') + call add(argv, '--interactive') + endif + call extend(argv, args) + + let [mp, efm] = [&l:mp, &l:efm] try let cdback = s:Cd(s:Tree(dir)) let &l:errorformat = '' @@ -3510,30 +3524,28 @@ function! s:MergeRebase(cmd, bang, mods, args, ...) abort if a:cmd =~# '^merge' && empty(args) && \ (had_merge_msg || isdirectory(fugitive#Find('.git/rebase-apply', dir)) || \ !empty(s:TreeChomp(dir, 'diff-files', '--diff-filter=U'))) - let &l:makeprg = g:fugitive_git_executable.' diff-files --name-status --diff-filter=U' + let cmd = g:fugitive_git_executable.' diff-files --name-status --diff-filter=U' else - let &l:makeprg = s:sub(s:UserCommand() . ' ' . a:cmd . - \ (s:HasOpt(args, '--no-edit', '--abort', '-m') || a:cmd =~# '^rebase' ? '' : ' --edit') . - \ (s:HasOpt(args, '--autosquash') && a:cmd =~# '^rebase' ? ' --interactive' : '') . - \ ' ' . s:shellesc(args), ' *$', '') + let cmd = s:shellesc(argv) endif if !empty($GIT_SEQUENCE_EDITOR) || has('win32') let old_sequence_editor = $GIT_SEQUENCE_EDITOR let $GIT_SEQUENCE_EDITOR = 'true' else - let &l:makeprg = 'env GIT_SEQUENCE_EDITOR=true ' . &l:makeprg + let cmd = 'env GIT_SEQUENCE_EDITOR=true ' . cmd endif if !empty($GIT_EDITOR) || has('win32') let old_editor = $GIT_EDITOR let $GIT_EDITOR = 'false' else - let &l:makeprg = 'env GIT_EDITOR=false ' . substitute(&l:makeprg, '^env ', '', '') + let cmd = 'env GIT_EDITOR=false ' . substitute(cmd, '^env ', '', '') endif if !has('patch-8.1.0334') && has('terminal') && &autowrite let autowrite_was_set = 1 set noautowrite silent! wall endif + let &l:makeprg = cmd silent noautocmd make! catch /^Vim\%((\a\+)\)\=:E211/ let err = v:exception @@ -3613,7 +3625,7 @@ function! s:RebaseSubcommand(line1, line2, range, bang, mods, args) abort endfunction function! s:PullSubcommand(line1, line2, range, bang, mods, args) abort - return s:MergeRebase('pull --progress', a:bang, a:mods, a:args) + return s:MergeRebase('pull', a:bang, a:mods, a:args) endfunction augroup fugitive_merge