Function: git-rebase-current-line

git-rebase-current-line is an autoloaded and byte-compiled function defined in git-rebase.el.

Signature

(git-rebase-current-line &optional BATCH)

Documentation

Parse current line into a git-rebase-action(var)/git-rebase-action(fun) instance.

If the current line isn't recognized as a rebase line, an instance with all nil values is returned, unless optional BATCH is non-nil, in which case nil is returned. Non-nil BATCH also ignores commented lines.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/git-rebase.el
;;;###autoload
(defun git-rebase-current-line (&optional batch)
  "Parse current line into a `git-rebase-action' instance.
If the current line isn't recognized as a rebase line, an
instance with all nil values is returned, unless optional
BATCH is non-nil, in which case nil is returned.  Non-nil
BATCH also ignores commented lines."
  (save-excursion
    (goto-char (line-beginning-position))
    (cond-let*
      ([re-start (if batch
                     "^"
                   (format "^\\(?99:%s\\)? *" (regexp-quote comment-start)))]
       [type (seq-some (pcase-lambda (`(,type . ,re))
                         (let ((case-fold-search nil))
                           (and (looking-at (concat re-start re)) type)))
                       git-rebase-line-regexps)]
       (git-rebase-action
        :action-type    type
        :action         (and-let ((action (match-str 1)))
                          (or (cdr (assoc action git-rebase-short-options))
                              action))
        :action-options (match-str 2)
        :target         (match-str 3)
        :trailer        (match-str 5)
        :comment-p      (and (match-str 99) t)))
      ((not batch)
       ;; Use empty object rather than nil to ease handling.
       (git-rebase-action)))))