Add an option to confirm reverting an item.
This commit is contained in:
parent
abba1a02e2
commit
f8e429e8de
1 changed files with 18 additions and 10 deletions
10
magit.el
10
magit.el
|
@ -136,6 +136,11 @@ Setting this to nil will make it do nothing, setting it to t will arrange things
|
||||||
(const :tag "Immediately" 0)
|
(const :tag "Immediately" 0)
|
||||||
(integer :tag "After this many seconds")))
|
(integer :tag "After this many seconds")))
|
||||||
|
|
||||||
|
(defcustom magit-revert-item-confirm nil
|
||||||
|
"Require acknowledgment before reverting an item"
|
||||||
|
:group 'magit
|
||||||
|
:type 'boolean)
|
||||||
|
|
||||||
(defcustom magit-log-edit-confirm-cancellation nil
|
(defcustom magit-log-edit-confirm-cancellation nil
|
||||||
"Require acknowledgment before canceling the log edit buffer."
|
"Require acknowledgment before canceling the log edit buffer."
|
||||||
:group 'magit
|
:group 'magit
|
||||||
|
@ -3417,6 +3422,9 @@ With prefix argument, changes in staging area are kept.
|
||||||
|
|
||||||
(defun magit-revert-item ()
|
(defun magit-revert-item ()
|
||||||
(interactive)
|
(interactive)
|
||||||
|
(when (or (not magit-revert-item-confirm)
|
||||||
|
(yes-or-no-p
|
||||||
|
"Really revert this item (cannot be undone)? "))
|
||||||
(magit-section-action (item info "revert")
|
(magit-section-action (item info "revert")
|
||||||
((pending commit)
|
((pending commit)
|
||||||
(magit-apply-commit info nil nil t)
|
(magit-apply-commit info nil nil t)
|
||||||
|
@ -3426,7 +3434,7 @@ With prefix argument, changes in staging area are kept.
|
||||||
((hunk)
|
((hunk)
|
||||||
(magit-apply-hunk-item-reverse item))
|
(magit-apply-hunk-item-reverse item))
|
||||||
((diff)
|
((diff)
|
||||||
(magit-apply-diff-item item "--reverse"))))
|
(magit-apply-diff-item item "--reverse")))))
|
||||||
|
|
||||||
(defvar magit-have-graph 'unset)
|
(defvar magit-have-graph 'unset)
|
||||||
(defvar magit-have-decorate 'unset)
|
(defvar magit-have-decorate 'unset)
|
||||||
|
|
Loading…
Reference in a new issue