Function: magit-rebase--todo

magit-rebase--todo is a byte-compiled function defined in magit-sequence.el.

Signature

(magit-rebase--todo)

Documentation

Return git-rebase-action(var)/git-rebase-action(fun) instances for remaining rebase actions.

These are ordered the same way they'll be sorted in the status buffer (i.e., the reverse of how they will be applied).

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-sequence.el
(defun magit-rebase--todo ()
  "Return `git-rebase-action' instances for remaining rebase actions.
These are ordered the same way they'll be sorted in the status
buffer (i.e., the reverse of how they will be applied)."
  (let ((comment-start (or (magit-get "core.commentChar") "#"))
        (commits ())
        (actions ()))
    (with-temp-buffer
      (insert-file-contents
       (expand-file-name "rebase-merge/git-rebase-todo" (magit-gitdir)))
      (while (not (eobp))
        (when-let ((obj (git-rebase-current-line t)))
          (push obj actions)
          (when (memq (oref obj action-type) '(commit merge))
            (push obj commits)))
        (forward-line)))
    (let ((abbrevs
           (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-str 1 options)))
                             (oref obj target)))
                         commits)))))
      (cl-assert (equal (length commits) (length abbrevs)))
      (while-let ((obj (pop commits))
                  (val (pop abbrevs)))
        (oset obj abbrev val)))
    actions))