From 1d91517cdb7dfccced70801796cba22b30eade07 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 1 Apr 2021 19:44:02 -0400 Subject: [PATCH] Don't discard deleted submodules There isn't a good command to use for the undo. References https://github.com/tpope/vim-fugitive/issues/1705 --- autoload/fugitive.vim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index c17ab69..041c160 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -3926,13 +3926,13 @@ function! s:StageDelete(lnum1, lnum2, count) abort continue endif let sub = get(get(get(b:fugitive_files, info.section, {}), info.filename, {}), 'submodule') - if info.status ==# 'D' - let undo = 'GRemove' - elseif sub =~# '^S' && info.status !~# '[MD]' - let err .= '|echoerr ' . string('fugitive: will not delete submodule ' . string(info.relative[0])) - break - elseif sub =~# '^S' + if sub =~# '^S' && info.status ==# 'M' let undo = 'Git checkout ' . fugitive#RevParse('HEAD', FugitiveExtractGitDir(info.paths[0]))[0:10] . ' --' + elseif sub =~# '^S' + let err .= '|echoerr ' . string('fugitive: will not touch submodule ' . string(info.relative[0])) + break + elseif info.status ==# 'D' + let undo = 'GRemove' elseif info.paths[0] =~# '/$' let err .= '|echoerr ' . string('fugitive: will not delete directory ' . string(info.relative[0])) break