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

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

[nongnu] elpa/git-commit 0e12e87: magit-stash-both: Ask before losing me


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit 0e12e87: magit-stash-both: Ask before losing merge state
Date: Sun, 8 Aug 2021 12:57:16 -0400 (EDT)

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

    magit-stash-both: Ask before losing merge state
    
    Like some "git stash save" variants, `magit-stash-both' calls "git
    reset --hard", which among other things discards merge state. This
    is intentional but likely surprising so ask users if they really
    want that.
    
    Closes #4345.
---
 Documentation/RelNotes/3.3.0.org | 2 ++
 lisp/magit-stash.el              | 9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Documentation/RelNotes/3.3.0.org b/Documentation/RelNotes/3.3.0.org
index 55efbcc..02b883e 100644
--- a/Documentation/RelNotes/3.3.0.org
+++ b/Documentation/RelNotes/3.3.0.org
@@ -5,6 +5,8 @@
 - No longer automatically add ~--full-history~ when showing log for a
   single file that isn't being tracked anymore.  #4381
 
+- ~magit-stash-both~ now asks before discarding merge state.  #4345
+
 ** Fixes since v3.2.0
 
 - Make ~magit-branch-remote-head~ and ~magit-branch-current~ fall back
diff --git a/lisp/magit-stash.el b/lisp/magit-stash.el
index 3ff6858..62c143a 100644
--- a/lisp/magit-stash.el
+++ b/lisp/magit-stash.el
@@ -125,7 +125,14 @@ AUTHOR-WIDTH has to be an integer.  When the name of the 
author
 Untracked files are included according to infix arguments.
 One prefix argument is equivalent to `--include-untracked'
 while two prefix arguments are equivalent to `--all'."
-  (interactive (magit-stash-read-args))
+  (interactive
+   (progn (when (and (magit-merge-in-progress-p)
+                     (not (magit-y-or-n-p "\
+Stashing and resetting during a merge conflict. \
+Applying the resulting stash won't restored the merge state. \
+Proceed anyway? ")))
+            (user-error "Abort"))
+          (magit-stash-read-args)))
   (magit-stash-save message t t include-untracked t))
 
 ;;;###autoload



reply via email to

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