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)
|
||||
continue
|
||||
endif
|
||||
let hash = s:TreeChomp('hash-object', '-w', '--', info.paths[0])
|
||||
if empty(hash)
|
||||
continue
|
||||
if info.status ==# 'D'
|
||||
let undo = 'Gremove'
|
||||
else
|
||||
let undo = 'Gread ' . s:TreeChomp('hash-object', '-w', '--', info.paths[0])[0:10]
|
||||
endif
|
||||
if info.patch
|
||||
call s:StageApply(info, 1, info.section ==# 'Staged' ? ['--index'] : [])
|
||||
@@ -3029,7 +3030,7 @@ function! s:StageDelete(lnum1, lnum2, count) abort
|
||||
else
|
||||
call s:TreeChomp('checkout', 'HEAD^{}', '--', info.paths[0])
|
||||
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
|
||||
catch /^fugitive:/
|
||||
let err = '|echoerr ' . string(v:exception)
|
||||
|
||||
Reference in New Issue
Block a user