Add experimental behavior for X on commit line

Resolves: https://github.com/tpope/vim-fugitive/issues/1847
This commit is contained in:
Tim Pope
2021-09-25 10:19:21 -04:00
parent 915c050724
commit 7b05afd548

View File

@@ -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