Function: magit--insert-log

magit--insert-log is a byte-compiled function defined in magit-log.el.

Signature

(magit--insert-log KEEP-ERROR REVS &optional ARGS FILES)

Documentation

Insert a log section.

Do not add this to a hook variable.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-log.el
          "%s"))       ; \n ..  headers  magit-log-revision-headers-format

(defun magit--insert-log (keep-error revs &optional args files)
  "Insert a log section.
Do not add this to a hook variable."
  (declare (indent defun))
  (setq magit-section-preserve-visibility t) ; TODO do it here?
  (let ((magit-git-global-arguments
         (remove "--literal-pathspecs" magit-git-global-arguments)))
    (magit--git-wash (apply-partially #'magit-log-wash-log 'log) keep-error
      "log"
      (format magit-log-heading-format
              (if (and (member "--left-right" args)
                       (not (member "--graph" args)))
                  "%m "
                "")
              (if (member "--decorate" args) "%D" "")
              (if (not (member "--show-signature" args))
                  ""
                (setq args (remove "--show-signature" args))
                (let ((limit (magit-log-get-commit-limit args)))
                  (cond
                    ((not limit)
                     (message
                      "Dropping --show-signature because -n isn't set (see %s)"
                      'magit-log-show-signatures-limit)
                     "")
                    ((> limit magit-log-show-signatures-limit)
                     (message
                      "Dropping --show-signature because -n is larger than %s"
                      'magit-log-show-signatures-limit)
                     "")
                    ("%G?"))))
              (if magit-log-margin-show-committer-date "%ct" "%at")
              (if magit-log-trailer-labels
                  (format "%%(trailers:%s%s)"
                          (if (not (equal (cdr magit-log-trailer-labels) ""))
                              (concat (cdr magit-log-trailer-labels) ",")
                            "")
                          "unfold=true,separator=,key_value_separator=")
                "")
              (if (member "++header" args)
                  (if (member "--graph" (setq args (remove "++header" args)))
                      (concat "\n" magit-log-revision-headers-format "\n")
                    (concat "\n" magit-log-revision-headers-format "\n"))
                ""))
      (progn
        (when-let ((order (seq-find (##string-match "^\\+\\+order=\\(.+\\)$" %)
                                    args)))
          (setq args (cons (format "--%s-order" (match-str 1 order))
                           (remove order args))))
        (when (member "--decorate" args)
          (setq args (cons "--decorate=full" (remove "--decorate" args))))
        (when (member "--reverse" args)
          (setq args (remove "--graph" args)))
        (setq args (magit-diff--maybe-add-stat-arguments args))
        args)
      "--use-mailmap" "--no-prefix" revs "--" files)))