mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-12 13:23:52 -05:00
Add experimental behavior for X on commit line
Resolves: https://github.com/tpope/vim-fugitive/issues/1847
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user