mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-08 11:33:47 -05:00
Fix X on removed file
References https://github.com/tpope/vim-fugitive/issues/1343
This commit is contained in:
@@ -3005,9 +3005,10 @@ function! s:StageDelete(lnum1, lnum2, count) abort
|
|||||||
if empty(info.paths)
|
if empty(info.paths)
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
let hash = s:TreeChomp('hash-object', '-w', '--', info.paths[0])
|
if info.status ==# 'D'
|
||||||
if empty(hash)
|
let undo = 'Gremove'
|
||||||
continue
|
else
|
||||||
|
let undo = 'Gread ' . s:TreeChomp('hash-object', '-w', '--', info.paths[0])[0:10]
|
||||||
endif
|
endif
|
||||||
if info.patch
|
if info.patch
|
||||||
call s:StageApply(info, 1, info.section ==# 'Staged' ? ['--index'] : [])
|
call s:StageApply(info, 1, info.section ==# 'Staged' ? ['--index'] : [])
|
||||||
@@ -3029,7 +3030,7 @@ function! s:StageDelete(lnum1, lnum2, count) abort
|
|||||||
else
|
else
|
||||||
call s:TreeChomp('checkout', 'HEAD^{}', '--', info.paths[0])
|
call s:TreeChomp('checkout', 'HEAD^{}', '--', info.paths[0])
|
||||||
endif
|
endif
|
||||||
call add(restore, ':Gsplit ' . s:fnameescape(info.relative[0]) . '|Gread ' . hash[0:6])
|
call add(restore, ':Gsplit ' . s:fnameescape(info.relative[0]) . '|' . undo)
|
||||||
endfor
|
endfor
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
let err = '|echoerr ' . string(v:exception)
|
let err = '|echoerr ' . string(v:exception)
|
||||||
|
|||||||
Reference in New Issue
Block a user