aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2025-05-13 18:54:50 +0200
committerJonas Bernoulli <jonas@bernoul.li>2025-05-13 18:54:50 +0200
commit17c831a2cd1118dd9e364d03209d83538926613b (patch)
treee8a8650483a0429dfc7805a7078fcf5292e8b7aa
parentf88225f6a8731a5f950e7c6e4c955eddbf820c87 (diff)
magit-rebase--todo: Don't abbreviate empty set of commits
When rebase stops at the last commit, then the list of commits yet to be rebases is (obviously) empty. Don't call "git log --no-walk --format=%h [<commit>...]" in that case, because if that is called without any revision arguments, it shows information for HEAD. That resulted in an error because we later assert that the commit and abbreviation lists have the same length. Re #5365.
-rw-r--r--lisp/magit-sequence.el19
1 files changed, 10 insertions, 9 deletions
diff --git a/lisp/magit-sequence.el b/lisp/magit-sequence.el
index 5711525..90e352a 100644
--- a/lisp/magit-sequence.el
+++ b/lisp/magit-sequence.el
@@ -1003,15 +1003,16 @@ status buffer (i.e., the reverse of how they will be applied)."
(push obj commits)))
(forward-line)))
(let ((abbrevs
- (magit-git-lines
- "log" "--no-walk=unsorted" "--format=%h"
- (mapcar (lambda (obj)
- (if (eq (oref obj action-type) 'merge)
- (let ((options (oref obj action-options)))
- (and (string-match "-[cC] \\([^ ]+\\)" options)
- (match-string 1 options)))
- (oref obj target)))
- commits))))
+ (and commits
+ (magit-git-lines
+ "log" "--no-walk=unsorted" "--format=%h"
+ (mapcar (lambda (obj)
+ (if (eq (oref obj action-type) 'merge)
+ (let ((options (oref obj action-options)))
+ (and (string-match "-[cC] \\([^ ]+\\)" options)
+ (match-string 1 options)))
+ (oref obj target)))
+ commits)))))
(cl-assert (equal (length commits) (length abbrevs)))
(while-let ((obj (pop commits))
(val (pop abbrevs)))