Add default core.askPass to :Gpull

This commit is contained in:
Tim Pope 2019-08-06 19:57:27 -04:00
parent 511e32114b
commit d7172882b7

View File

@ -3482,8 +3482,22 @@ function! s:MergeRebase(cmd, bang, mods, args, ...) abort
endif endif
endif endif
endif endif
let [mp, efm] = [&l:mp, &l:efm]
let had_merge_msg = filereadable(fugitive#Find('.git/MERGE_MSG', dir)) 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 try
let cdback = s:Cd(s:Tree(dir)) let cdback = s:Cd(s:Tree(dir))
let &l:errorformat = '' let &l:errorformat = ''
@ -3510,30 +3524,28 @@ function! s:MergeRebase(cmd, bang, mods, args, ...) abort
if a:cmd =~# '^merge' && empty(args) && if a:cmd =~# '^merge' && empty(args) &&
\ (had_merge_msg || isdirectory(fugitive#Find('.git/rebase-apply', dir)) || \ (had_merge_msg || isdirectory(fugitive#Find('.git/rebase-apply', dir)) ||
\ !empty(s:TreeChomp(dir, 'diff-files', '--diff-filter=U'))) \ !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 else
let &l:makeprg = s:sub(s:UserCommand() . ' ' . a:cmd . let cmd = s:shellesc(argv)
\ (s:HasOpt(args, '--no-edit', '--abort', '-m') || a:cmd =~# '^rebase' ? '' : ' --edit') .
\ (s:HasOpt(args, '--autosquash') && a:cmd =~# '^rebase' ? ' --interactive' : '') .
\ ' ' . s:shellesc(args), ' *$', '')
endif endif
if !empty($GIT_SEQUENCE_EDITOR) || has('win32') if !empty($GIT_SEQUENCE_EDITOR) || has('win32')
let old_sequence_editor = $GIT_SEQUENCE_EDITOR let old_sequence_editor = $GIT_SEQUENCE_EDITOR
let $GIT_SEQUENCE_EDITOR = 'true' let $GIT_SEQUENCE_EDITOR = 'true'
else else
let &l:makeprg = 'env GIT_SEQUENCE_EDITOR=true ' . &l:makeprg let cmd = 'env GIT_SEQUENCE_EDITOR=true ' . cmd
endif endif
if !empty($GIT_EDITOR) || has('win32') if !empty($GIT_EDITOR) || has('win32')
let old_editor = $GIT_EDITOR let old_editor = $GIT_EDITOR
let $GIT_EDITOR = 'false' let $GIT_EDITOR = 'false'
else else
let &l:makeprg = 'env GIT_EDITOR=false ' . substitute(&l:makeprg, '^env ', '', '') let cmd = 'env GIT_EDITOR=false ' . substitute(cmd, '^env ', '', '')
endif endif
if !has('patch-8.1.0334') && has('terminal') && &autowrite if !has('patch-8.1.0334') && has('terminal') && &autowrite
let autowrite_was_set = 1 let autowrite_was_set = 1
set noautowrite set noautowrite
silent! wall silent! wall
endif endif
let &l:makeprg = cmd
silent noautocmd make! silent noautocmd make!
catch /^Vim\%((\a\+)\)\=:E211/ catch /^Vim\%((\a\+)\)\=:E211/
let err = v:exception let err = v:exception
@ -3613,7 +3625,7 @@ function! s:RebaseSubcommand(line1, line2, range, bang, mods, args) abort
endfunction endfunction
function! s:PullSubcommand(line1, line2, range, bang, mods, args) abort 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 endfunction
augroup fugitive_merge augroup fugitive_merge