Remove dispatch.vim backed fetch and push

This commit is contained in:
Tim Pope
2021-02-12 18:29:06 -05:00
parent 0cc2190889
commit d4bcc75ef6
2 changed files with 11 additions and 57 deletions

View File

@@ -92,17 +92,18 @@ Install using your favorite package manager, or use Vim's built-in package suppo
## FAQ
> Why can't I enter my password when I `:Git push`?
> What happened to the dispatch.vim backed asynchronous `:Gpush` and
> `:Gfetch`?
It is highly recommended to use SSH keys or [credentials caching][] to avoid
entering your password on every upstream interaction. If this isn't an
option, the official solution is to use the `core.askPass` Git option to
request the password via a GUI. Fugitive will configure this for you
automatically if you have `ssh-askpass` or `git-gui` installed; otherwise it's
your responsibility to set this up.
This behavior was divisive, confusing, and complicated inputting passwords, so
it was removed. Use `:Dispatch git push` for effectively the same behavior,
or provide your own asynchronous `:Gpush` and `:Gfetch` by adding the
following to your vimrc:
If you absolutely must type in your password by hand, sidestep Fugitive and
use `:terminal git push`.
command! -bang -bar -nargs=* Gpush execute 'Dispatch<bang> -dir=' .
\ fnameescape(FugitiveGitDir()) 'git push' <q-args>
command! -bang -bar -nargs=* Gfetch execute 'Dispatch<bang> -dir=' .
\ fnameescape(FugitiveGitDir()) 'git fetch' <q-args>
[credentials caching]: https://help.github.com/en/articles/caching-your-github-password-in-git

View File

@@ -664,14 +664,6 @@ function! s:QuickfixStream(nr, event, title, cmd, first, callback, ...) abort
endif
endfunction
let s:common_efm = ''
\ . '%+Egit:%.%#,'
\ . '%+Eusage:%.%#,'
\ . '%+Eerror:%.%#,'
\ . '%+Efatal:%.%#,'
\ . '%-G%.%#%\e[K%.%#,'
\ . '%-G%.%#%\r%.%\+'
function! fugitive#Cwindow() abort
if &buftype == 'quickfix'
cwindow
@@ -1967,7 +1959,7 @@ function! fugitive#BufReadStatus() abort
if &bufhidden ==# ''
setlocal bufhidden=delete
endif
let b:dispatch = ':Git fetch --all'
let b:dispatch = '-dir=' . fnameescape(len(s:Tree()) ? s:Tree() : s:Dir()) . ' ' . g:fugitive_git_executable . ' fetch --all'
call fugitive#MapJumps()
call s:Map('n', '-', ":<C-U>execute <SID>Do('Toggle',0)<CR>", '<silent>')
call s:Map('x', '-', ":<C-U>execute <SID>Do('Toggle',1)<CR>", '<silent>')
@@ -4780,45 +4772,6 @@ function! fugitive#FetchComplete(A, L, P, ...) abort
return s:CompleteSub('fetch', a:A, a:L, a:P, function('s:CompleteRemote'), a:000)
endfunction
function! s:Dispatch(bang, options) abort
let dir = a:options.dir
exe s:DirCheck(dir)
let [mp, efm, cc] = [&l:mp, &l:efm, get(b:, 'current_compiler', '')]
try
let b:current_compiler = 'git'
let &l:errorformat = s:common_efm .
\ ',%\&git_dir=' . escape(substitute(dir, '%', '%%', 'g'), '\,')
let &l:makeprg = s:UserCommand({'git': a:options.git, 'dir': dir}, s:AskPassArgs(dir) + a:options.flags + [a:options.command] + a:options.args)
if exists(':Make') == 2
Make
return ''
else
if !has('patch-8.1.0334') && has('terminal') && &autowrite
let autowrite_was_set = 1
set noautowrite
silent! wall
endif
silent noautocmd make!
redraw!
return 'call fugitive#Cwindow()|silent ' . s:DoAutocmd('ShellCmdPost')
endif
finally
let [&l:mp, &l:efm, b:current_compiler] = [mp, efm, cc]
if empty(cc) | unlet! b:current_compiler | endif
if exists('autowrite_was_set')
set autowrite
endif
endtry
endfunction
function! s:PushSubcommand(line1, line2, range, bang, mods, options) abort
return s:Dispatch(a:bang ? '!' : '', a:options)
endfunction
function! s:FetchSubcommand(line1, line2, range, bang, mods, options) abort
return s:Dispatch(a:bang ? '!' : '', a:options)
endfunction
" Section: :Gdiff
augroup fugitive_diff