commit 1d91517cdb7dfccced70801796cba22b30eade07 (tree)
parent c028ea5a441a54c9e3a9e984cd229a165db297ec
Author: Tim Pope <code@tpope.net>
Date: Thu, 1 Apr 2021 19:44:02 -0400
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
Diffstat:
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git 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