Function: magit-diff-refresh-buffer

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

Signature

(magit-diff-refresh-buffer)

Documentation

Refresh the current magit-diff-mode buffer.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-diff.el
(defun magit-diff-refresh-buffer ()
  "Refresh the current `magit-diff-mode' buffer."
  (magit-set-header-line-format
   (if (equal magit-buffer-diff-typearg "--no-index")
       (apply #'format "Differences between %s and %s" magit-buffer-diff-files)
     (concat (cond (magit-buffer-diff-range
                    (cond-let
                      ((string-match-p "\\(\\.\\.\\|\\^-\\)"
                                       magit-buffer-diff-range)
                       (format "Changes in %s" magit-buffer-diff-range))
                      [[msg "Changes from %s to %s"]
                       [end (if (equal magit-buffer-diff-typearg "--cached")
                                "index"
                              "working tree")]]
                      ((member "-R" magit-buffer-diff-args)
                       (format msg end magit-buffer-diff-range))
                      ((format msg magit-buffer-diff-range end))))
                   ((equal magit-buffer-diff-typearg "--cached")
                    "Staged changes")
                   ((and (magit-repository-local-get 'this-commit-command)
                         (not (magit-anything-staged-p)))
                    "Uncommitting changes")
                   ("Unstaged changes"))
             (pcase (length magit-buffer-diff-files)
               (0)
               (1 (concat " in file " (car magit-buffer-diff-files)))
               (_ (concat " in files "
                          (string-join magit-buffer-diff-files ", ")))))))
  (setq magit-buffer-diff-range-oids
        (and magit-buffer-diff-range
             (magit-hash-range magit-buffer-diff-range)))
  (magit-insert-section (diffbuf)
    (magit-run-section-hook 'magit-diff-sections-hook)))