From d4bcc75ef6449c0e5592513fb1e0a42b017db9ca Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 12 Feb 2021 18:29:06 -0500 Subject: [PATCH] Remove dispatch.vim backed fetch and push --- README.markdown | 19 +++++++++-------- autoload/fugitive.vim | 49 +------------------------------------------ 2 files changed, 11 insertions(+), 57 deletions(-) diff --git a/README.markdown b/README.markdown index dd3bcc9..5f3b346 100644 --- a/README.markdown +++ b/README.markdown @@ -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 -dir=' . + \ fnameescape(FugitiveGitDir()) 'git push' + command! -bang -bar -nargs=* Gfetch execute 'Dispatch -dir=' . + \ fnameescape(FugitiveGitDir()) 'git fetch' [credentials caching]: https://help.github.com/en/articles/caching-your-github-password-in-git diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 0999778..b47fcbc 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -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', '-', ":execute Do('Toggle',0)", '') call s:Map('x', '-', ":execute Do('Toggle',1)", '') @@ -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