emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/git-commit fb1a3c487e 2/2: magit-sequencer-abort: Require


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit fb1a3c487e 2/2: magit-sequencer-abort: Require confirmation
Date: Fri, 17 Nov 2023 15:59:34 -0500 (EST)

branch: elpa/git-commit
commit fb1a3c487eabe51f2bf5f80cb9a6d9e43172f8b0
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    magit-sequencer-abort: Require confirmation
    
    Closes #5051.
---
 docs/magit.org         |  7 +++++++
 docs/magit.texi        |  9 +++++++++
 lisp/magit-base.el     |  9 +++++++++
 lisp/magit-sequence.el | 12 ++++++++----
 4 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/docs/magit.org b/docs/magit.org
index 41a40bad10..257132589b 100644
--- a/docs/magit.org
+++ b/docs/magit.org
@@ -1460,6 +1460,13 @@ telling Magit to ask fewer questions.
     - ~reset-bisect~ Aborting (known to Git as "resetting") a bisect
       operation loses all information collected so far.
 
+    - ~abort-cherry-pick~ Aborting a cherry-pick throws away all
+      conflict resolutions which has already been carried out by the
+      user.
+
+    - ~abort-revert~ Aborting a revert throws away all conflict
+      resolutions which has already been carried out by the user.
+
     - ~abort-rebase~ Aborting a rebase throws away all already modified
       commits, but it's possible to restore those from the reflog.
 
diff --git a/docs/magit.texi b/docs/magit.texi
index 9af3b5c02f..e131d1eee6 100644
--- a/docs/magit.texi
+++ b/docs/magit.texi
@@ -1934,6 +1934,15 @@ Sequences:
 @code{reset-bisect} Aborting (known to Git as "resetting") a bisect
 operation loses all information collected so far.
 
+@item
+@code{abort-cherry-pick} Aborting a cherry-pick throws away all
+conflict resolutions which has already been carried out by the
+user.
+
+@item
+@code{abort-revert} Aborting a revert throws away all conflict
+resolutions which has already been carried out by the user.
+
 @item
 @code{abort-rebase} Aborting a rebase throws away all already modified
 commits, but it's possible to restore those from the reflog.
diff --git a/lisp/magit-base.el b/lisp/magit-base.el
index 607c78eb1e..17943d79f0 100644
--- a/lisp/magit-base.el
+++ b/lisp/magit-base.el
@@ -144,6 +144,8 @@ The value has the form ((COMMAND nil|PROMPT DEFAULT)...).
     (const untrack)
     (const rename)
     (const reset-bisect)
+    (const abort-cherry-pick)
+    (const abort-revert)
     (const abort-rebase)
     (const abort-merge)
     (const merge-dirty)
@@ -211,6 +213,13 @@ Sequences:
   `reset-bisect' Aborting (known to Git as \"resetting\") a
   bisect operation loses all information collected so far.
 
+  `abort-cherry-pick' Aborting a cherry-pick throws away all
+  conflict resolutions which has already been carried out by the
+  user.
+
+  `abort-revert' Aborting a revert throws away all conflict
+  resolutions which has already been carried out by the user.
+
   `abort-rebase' Aborting a rebase throws away all already
   modified commits, but it's possible to restore those from the
   reflog.
diff --git a/lisp/magit-sequence.el b/lisp/magit-sequence.el
index 5a8b66b4d3..f9d679fcc0 100644
--- a/lisp/magit-sequence.el
+++ b/lisp/magit-sequence.el
@@ -112,10 +112,14 @@
   "Abort the current cherry-pick or revert sequence.
 This discards all changes made since the sequence started."
   (interactive)
-  (if (magit-sequencer-in-progress-p)
-      (magit-run-git-sequencer
-       (if (magit-revert-in-progress-p) "revert" "cherry-pick") "--abort")
-    (user-error "No cherry-pick or revert in progress")))
+  (cond
+   ((not (magit-sequencer-in-progress-p))
+    (user-error "No cherry-pick or revert in progress"))
+   ((magit-revert-in-progress-p)
+    (magit-confirm 'abort-revert "Really abort revert")
+    (magit-run-git-sequencer "revert" "--abort"))
+   ((magit-confirm 'abort-cherry-pick "Really abort cherry-pick")
+    (magit-run-git-sequencer "cherry-pick" "--abort"))))
 
 (defun magit-sequencer-in-progress-p ()
   (or (magit-cherry-pick-in-progress-p)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]