Function: magit--insert-diff

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

Signature

(magit--insert-diff KEEP-ERROR &rest ARGS)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-diff.el
(defun magit--insert-diff (keep-error &rest args)
  (declare (indent 1))
  (pcase-let ((`(,cmd . ,args)
               (flatten-tree args))
              (magit-git-global-arguments
               (remove "--literal-pathspecs" magit-git-global-arguments)))
    ;; We need to generate diffs with --ita-visible-in-index so that
    ;; `magit-stage' can work with intent-to-add files (see #4026).
    (unless (equal cmd "merge-tree")
      (push "--ita-visible-in-index" args))
    (setq args (magit-diff--maybe-add-stat-arguments args))
    (when (magit--any (##string-prefix-p "--color-moved" %) args)
      (push "--color=always" args)
      (setq magit-git-global-arguments
            (append magit-diff--reset-non-color-moved
                    magit-git-global-arguments)))
    (magit--git-wash #'magit-diff-wash-diffs
        (if (member "--no-index" args)
            'wash-anyway
          (or keep-error t))
      cmd args)))