Function: git-commit--insert-trailer-1
git-commit--insert-trailer-1 is a byte-compiled function defined in
git-commit.el.
Signature
(git-commit--insert-trailer-1 STRING &optional BEFORE-TRAILERS)
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260822.1158/git-commit.el
(defun git-commit--insert-trailer-1 (string &optional before-trailers)
(save-excursion
(goto-char (point-min))
(while (looking-at comment-start)
(forward-line))
(when (or (eobp) (looking-at "diff --git"))
(goto-char (point-min))
(save-excursion (insert ?\n)))
(let ((bound (and (not (or (bobp) (eobp))) (point))))
(goto-char (point-max))
(unless (or (bobp) (= (char-before) ?\n))
(insert ?\n))
(cond (before-trailers
(git-commit--goto-insert-position bound)
(while (re-search-backward (git-commit--trailer-regexp) nil t))
(unless (looking-back "\n\n" nil)
(insert ?\n)))
((re-search-backward (git-commit--trailer-regexp) nil t)
(goto-char (match-end 0))
(if (eobp) (insert ?\n) (forward-char)))
(t
(git-commit--goto-insert-position bound)
(unless (looking-back "\n\n" nil)
(insert ?\n)))))
(insert string)
(unless (ignore-errors (= (char-before) ?\n)) (insert ?\n))
(unless (ignore-errors (= (char-after) ?\n)) (insert ?\n))))