diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 32d7a7c..c7b0777 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -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)