Only discard staged diffs for files that don't have unstaged changes.
The unstaged changes will be discarded, too, which might be unexpected. * magit.el (magit-discard-item): Here.
This commit is contained in:
parent
d7be60af1c
commit
03329dbfc3
1 changed files with 5 additions and 1 deletions
6
magit.el
6
magit.el
|
@ -41,6 +41,8 @@
|
||||||
;; - Showing tags.
|
;; - Showing tags.
|
||||||
;; - Visiting from staged hunks doesn't always work since the line
|
;; - Visiting from staged hunks doesn't always work since the line
|
||||||
;; numbers don't refer to the working tree. Fix that somehow.
|
;; numbers don't refer to the working tree. Fix that somehow.
|
||||||
|
;; - Figure out how to discard staged changes for files that also have
|
||||||
|
;; unstaged changes.
|
||||||
;; - Get current defun from removed lines in a diff
|
;; - Get current defun from removed lines in a diff
|
||||||
;; - Amending commits other than HEAD.
|
;; - Amending commits other than HEAD.
|
||||||
;; - 'Subsetting', only looking at a subset of all files.
|
;; - 'Subsetting', only looking at a subset of all files.
|
||||||
|
@ -2977,7 +2979,9 @@ Prefix arg means justify as well."
|
||||||
((unstaged diff)
|
((unstaged diff)
|
||||||
(magit-discard-diff item nil))
|
(magit-discard-diff item nil))
|
||||||
((staged diff)
|
((staged diff)
|
||||||
(magit-discard-diff item t))
|
(if (magit-file-uptodate-p (magit-diff-item-file item))
|
||||||
|
(magit-discard-diff item t)
|
||||||
|
(error "Can't discard staged changes to this file. Please unstage it first.")))
|
||||||
((hunk)
|
((hunk)
|
||||||
(error "Can't discard this hunk"))
|
(error "Can't discard this hunk"))
|
||||||
((diff)
|
((diff)
|
||||||
|
|
Loading…
Reference in a new issue