motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit 7b05afd548bd5e3f45e61fee3defc024a762adfd (tree)
parent 915c050724733e5649697a372822116c5b72da7e
Author: Tim Pope <code@tpope.net>
Date:   Sat, 25 Sep 2021 10:19:21 -0400

Add experimental behavior for X on commit line

Resolves: https://github.com/tpope/vim-fugitive/issues/1847

Diffstat:
Mautoload/fugitive.vim | 13++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim @@ -4804,9 +4804,13 @@ function! s:StageDelete(lnum1, lnum2, count) abort let err = '' let did_conflict_err = 0 + let reset_commit = matchstr(getline(a:lnum1), '^Un\w\+ \%(to\| from\) \zs\S\+') try for info in s:Selection(a:lnum1, a:lnum2) if empty(info.paths) + if len(info.commit) + let reset_commit = info.commit . '^' + endif continue endif let sub = get(get(get(b:fugitive_files, info.section, {}), info.filename, {}), 'submodule') @@ -4872,15 +4876,14 @@ function! s:StageDelete(lnum1, lnum2, count) abort let err .= '|echoerr ' . string(v:exception) endtry if empty(restore) + if len(reset_commit) && empty(err) + call feedkeys(':Git reset ' . reset_commit) + endif return err[1:-1] endif exe s:ReloadStatus() call s:StageReveal() - if len(restore) - return 'checktime|redraw|echomsg ' . string('To restore, ' . join(restore, '|')) . err - else - return 'checktime|redraw' . err - endif + return 'checktime|redraw|echomsg ' . string('To restore, ' . join(restore, '|')) . err endfunction function! s:StageIgnore(lnum1, lnum2, count) abort