branch: elpa/magit commit 17c831a2cd1118dd9e364d03209d83538926613b Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
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. --- lisp/magit-sequence.el | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lisp/magit-sequence.el b/lisp/magit-sequence.el index 57115250ed..90e352a7e2 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)))