Properly discard file deletions.
* magit.el (magit-discard-item): Reset a deleted file before checking it out. Otherwise a staged deletion can not be undone.
This commit is contained in:
parent
d80109e4ef
commit
fdee20de6f
1 changed files with 6 additions and 1 deletions
7
magit.el
7
magit.el
|
@ -1583,7 +1583,12 @@ Please see the manual for a complete description of Magit.
|
|||
((diff)
|
||||
(let ((kind (magit-diff-item-kind item))
|
||||
(file (magit-diff-item-file item)))
|
||||
(cond ((eq kind 'new)
|
||||
(cond ((eq kind 'deleted)
|
||||
(when (yes-or-no-p (format "Resurrect %s? " file))
|
||||
(magit-shell "git reset -q -- %s"
|
||||
(magit-escape-for-shell file))
|
||||
(magit-run "git" "checkout" "--" file)))
|
||||
((eq kind 'new)
|
||||
(if (yes-or-no-p (format "Delete %s? " file))
|
||||
(magit-run "git" "rm" "-f" "--" file)))
|
||||
(t
|
||||
|
|
Loading…
Reference in a new issue