branch: elpa/magit
commit 4fc60fdb36b74baca7421719f3a2e203ed16e6ed
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    magit-rebase--todo: Deal with duplicated commits
    
    Closes #5365.
---
 lisp/magit-sequence.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lisp/magit-sequence.el b/lisp/magit-sequence.el
index 1b3d08ecf9..e2fe295b27 100644
--- a/lisp/magit-sequence.el
+++ b/lisp/magit-sequence.el
@@ -1004,7 +1004,7 @@ status buffer (i.e., the reverse of how they will be 
applied)."
         (forward-line)))
     (let ((abbrevs
            (magit-git-lines
-            "log" "--no-walk" "--format=%h"
+            "log" "--no-walk" "--format=%H %h"
             (mapcar (lambda (obj)
                       (if (eq (oref obj action) 'merge)
                           (let ((options (oref obj action-options)))
@@ -1012,9 +1012,13 @@ status buffer (i.e., the reverse of how they will be 
applied)."
                                  (match-string 1 options)))
                         (oref obj target)))
                     commits))))
-      (while-let ((obj (pop commits))
-                  (val (pop abbrevs)))
-        (oset obj abbrev val)))
+      (while-let ((obj (pop commits)))
+        (let* ((rev (oref obj target))
+               (elt (assoc rev abbrevs)))
+          (cond (elt
+                 (setq abbrevs (delq elt abbrevs))
+                 (oset obj abbrev (cadr elt)))
+                ((oset obj abbrev (magit-rev-abbrev rev)))))))
     actions))
 
 (defun magit-rebase-insert-merge-sequence (onto)

Reply via email to