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

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

[nongnu] elpa/git-commit d1ad778280: magit-{cherry-pick, revert}-in-prog


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit d1ad778280: magit-{cherry-pick, revert}-in-progress-p: Restore sequencer/todo check
Date: Tue, 29 Mar 2022 22:58:08 -0400 (EDT)

branch: elpa/git-commit
commit d1ad778280f651f0ab87ce191784b96b3ebe312a
Author: Kyle Meyer <kyle@kyleam.com>
Commit: Kyle Meyer <kyle@kyleam.com>

    magit-{cherry-pick,revert}-in-progress-p: Restore sequencer/todo check
    
    7b29fb38 (magit-{sequencer,cherry-pick,revert}-in-progress-p: bugfix,
    2014-09-21) updated the -in-progress-p functions to look at the first
    line of $GIT_DIR/sequence/todo rather than $GIT_DIR/{ACTION}_HEAD.
    Then 6b05d124 (magit-{sequencer,cherry-pick,revert}-in-progress-p: fix
    last commit case, 2015-02-28) reverted back to checking just
    $GIT_DIR/{ACTION}_HEAD.
    
    Do both checks because neither is sufficient on its own (as suggested
    by the history above, gh-4646, and the checks in Git's sequencer.c and
    contrib/completion/git-prompt.sh).
    
    Fixes #4646.
---
 lisp/magit-sequence.el | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lisp/magit-sequence.el b/lisp/magit-sequence.el
index 6601b99d82..91e1d2df6d 100644
--- a/lisp/magit-sequence.el
+++ b/lisp/magit-sequence.el
@@ -357,7 +357,11 @@ the process manually."
 
 (defun magit-cherry-pick-in-progress-p ()
   ;; .git/sequencer/todo does not exist when there is only one commit left.
-  (file-exists-p (magit-git-dir "CHERRY_PICK_HEAD")))
+  (or (file-exists-p (magit-git-dir "CHERRY_PICK_HEAD"))
+      ;; And CHERRY_PICK_HEAD does not exist when a conflict happens
+      ;; while picking a series of commits with --no-commit.
+      (when-let ((line (magit-file-line (magit-git-dir "sequencer/todo"))))
+        (string-match-p "^pick" line))))
 
 ;;; Revert
 
@@ -409,7 +413,11 @@ without prompting."
 
 (defun magit-revert-in-progress-p ()
   ;; .git/sequencer/todo does not exist when there is only one commit left.
-  (file-exists-p (magit-git-dir "REVERT_HEAD")))
+  (or (file-exists-p (magit-git-dir "REVERT_HEAD"))
+      ;; And REVERT_HEAD does not exist when a conflict happens while
+      ;; reverting a series of commits with --no-commit.
+      (when-let ((line (magit-file-line (magit-git-dir "sequencer/todo"))))
+        (string-match-p "^revert" line))))
 
 ;;; Patch
 



reply via email to

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