mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-12-07 04:34:35 +08: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 err = ''
|
||||||
let did_conflict_err = 0
|
let did_conflict_err = 0
|
||||||
|
let reset_commit = matchstr(getline(a:lnum1), '^Un\w\+ \%(to\| from\) \zs\S\+')
|
||||||
try
|
try
|
||||||
for info in s:Selection(a:lnum1, a:lnum2)
|
for info in s:Selection(a:lnum1, a:lnum2)
|
||||||
if empty(info.paths)
|
if empty(info.paths)
|
||||||
|
if len(info.commit)
|
||||||
|
let reset_commit = info.commit . '^'
|
||||||
|
endif
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
let sub = get(get(get(b:fugitive_files, info.section, {}), info.filename, {}), 'submodule')
|
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)
|
let err .= '|echoerr ' . string(v:exception)
|
||||||
endtry
|
endtry
|
||||||
if empty(restore)
|
if empty(restore)
|
||||||
|
if len(reset_commit) && empty(err)
|
||||||
|
call feedkeys(':Git reset ' . reset_commit)
|
||||||
|
endif
|
||||||
return err[1:-1]
|
return err[1:-1]
|
||||||
endif
|
endif
|
||||||
exe s:ReloadStatus()
|
exe s:ReloadStatus()
|
||||||
call s:StageReveal()
|
call s:StageReveal()
|
||||||
if len(restore)
|
return 'checktime|redraw|echomsg ' . string('To restore, ' . join(restore, '|')) . err
|
||||||
return 'checktime|redraw|echomsg ' . string('To restore, ' . join(restore, '|')) . err
|
|
||||||
else
|
|
||||||
return 'checktime|redraw' . err
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:StageIgnore(lnum1, lnum2, count) abort
|
function! s:StageIgnore(lnum1, lnum2, count) abort
|
||||||
|
|||||||
Reference in New Issue
Block a user