Function: magit-process-insert-section

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

Signature

(magit-process-insert-section PWD PROGRAM ARGS &optional ERRCODE ERRLOG FACE)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-process.el
(defun magit-process-insert-section
    (pwd program args &optional errcode errlog face)
  (let ((inhibit-read-only t)
        (magit-insert-section--current nil)
        (magit-insert-section--parent magit-root-section)
        (magit-insert-section--oldroot nil))
    (goto-char (1- (point-max)))
    (magit-insert-section (process)
      (insert (if errcode
                  (format "%3s " (propertize (number-to-string errcode)
                                             'font-lock-face 'magit-process-ng))
                "run "))
      (when magit-process-timestamp-format
        (insert (format-time-string magit-process-timestamp-format) " "))
      (let ((cmd (concat
                  (and (not (equal
                             (file-name-as-directory (expand-file-name pwd))
                             (file-name-as-directory (expand-file-name
                                                      default-directory))))
                       (concat (file-relative-name pwd default-directory) " "))
                  (magit-process--format-arguments program args))))
        (magit-insert-heading
          (if face (magit--propertize-face cmd face) cmd)))
      (when errlog
        (if (bufferp errlog)
            (insert (with-current-buffer errlog
                      (buffer-substring-no-properties (point-min) (point-max))))
          (insert-file-contents errlog)
          (goto-char (1- (point-max)))))
      (insert "\n"))))