Function: majutsu-insert-diff

majutsu-insert-diff is a natively compiled function defined in majutsu-diff.el.

Signature

(majutsu-insert-diff)

Documentation

Insert a diff section and wash it.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-diff.el
(defun majutsu-insert-diff ()
  "Insert a diff section and wash it."
  (let* ((args (majutsu-jj-append-filesets
                (append (list "diff")
                        majutsu-buffer-diff-args
                        majutsu-buffer-diff-range)
                majutsu-buffer-diff-filesets))
         (backend (majutsu-diff--sync-backend args))
         (washer (majutsu-diff--backend-washer backend)))
    (magit-insert-section (diff-root)
      (magit-insert-heading (format "jj %s" (string-join args " ")))
      (majutsu-jj-wash
          (lambda (wash-args)
            ;; The Git command has already snapshotted the working copy.
            ;; Query the same range without snapshotting again, then
            ;; attach exact paths/statuses only if the ordered raw headers and
            ;; operation kinds agree.
            (let* ((metadata (and (eq backend 'git)
                                  (majutsu-diff--query-file-metadata
                                   majutsu-buffer-diff-range
                                   majutsu-buffer-diff-filesets)))
                   (matching-git-metadata
                    (and (majutsu-diff--raw-file-metadata-consistent-p metadata)
                         metadata))
                   (majutsu-diff--active-file-metadata matching-git-metadata)
                   (majutsu-diff--file-metadata-queue
                    (copy-sequence matching-git-metadata)))
              (funcall washer wash-args)
              (majutsu-diff--attach-file-metadata metadata)))
          'wash-anyway args))))