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:
Marius Vollmer 2008-09-07 19:46:47 +03:00
parent d80109e4ef
commit fdee20de6f

View file

@ -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