[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit 48ebba0a16 2/4: magit-commit-assert: Tweak beha
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit 48ebba0a16 2/4: magit-commit-assert: Tweak behavior for merge commits |
Date: |
Thu, 7 Sep 2023 18:59:29 -0400 (EDT) |
branch: elpa/git-commit
commit 48ebba0a161559942a716ca33787bedcdca9c41d
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
magit-commit-assert: Tweak behavior for merge commits
Signal an error if there are any unmerged changes.
Instead of unconditionally signaling an error when there are
unstaged changes, ask the user whether they want to proceed.
Closes #4985.
---
lisp/magit-commit.el | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/lisp/magit-commit.el b/lisp/magit-commit.el
index f6ee9ad5ae..d8d6bb6225 100644
--- a/lisp/magit-commit.el
+++ b/lisp/magit-commit.el
@@ -368,9 +368,14 @@ depending on the value of option
`magit-commit-squash-confirm'."
(setq this-command #'magit-rebase-continue)
(magit-run-git-sequencer "rebase" "--continue")
nil)
- ((and (file-exists-p (expand-file-name "MERGE_MSG" (magit-gitdir)))
- (not (magit-anything-unstaged-p)))
- (or args (list "--")))
+ ((file-exists-p (expand-file-name "MERGE_MSG" (magit-gitdir)))
+ (cond ((magit-anything-unmerged-p)
+ (user-error "Unresolved conflicts"))
+ ((and (magit-anything-unstaged-p)
+ (not (y-or-n-p
+ "Proceed with merge despite unstaged changes? ")))
+ (user-error "Abort"))
+ ((or args (list "--")))))
((not (magit-anything-unstaged-p))
(user-error "Nothing staged (or unstaged)"))
(magit-commit-ask-to-stage