Function: magit-zap-caches

magit-zap-caches is an interactive and byte-compiled function defined in magit-mode.el.

Signature

(magit-zap-caches &optional ALL)

Documentation

Zap caches for the current repository.

Remove the repository's entry from magit-repository-local-cache, remove the host's entry from magit--host-git-version-cache, set magit-section-visibility-cache to nil for all Magit buffers of the repository, and empty the magit--blob-cache.

With a prefix argument or if optional ALL is non-nil, discard the mentioned caches completely.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-mode.el
(defun magit-zap-caches (&optional all)
  "Zap caches for the current repository.

Remove the repository's entry from `magit-repository-local-cache',
remove the host's entry from `magit--host-git-version-cache', set
`magit-section-visibility-cache' to nil for all Magit buffers of
the repository, and empty the `magit--blob-cache'.

With a prefix argument or if optional ALL is non-nil, discard the
mentioned caches completely."
  (interactive)
  (magit--blob-cache-zap)
  (cond (all
         (setq magit-repository-local-cache nil)
         (setq magit--host-git-version-cache nil)
         (dolist (buffer (buffer-list))
           (with-current-buffer buffer
             (when (derived-mode-p 'magit-mode)
               (setq magit-section-visibility-cache nil)))))
        (t
         (magit-with-toplevel
           (setq magit-repository-local-cache
                 (cl-delete default-directory
                            magit-repository-local-cache
                            :key #'car :test #'equal))
           (setq magit--host-git-version-cache
                 (cl-delete (file-remote-p default-directory)
                            magit--host-git-version-cache
                            :key #'car :test #'equal)))
         (dolist (buffer (magit-mode-get-buffers))
           (with-current-buffer buffer
             (setq magit-section-visibility-cache nil))))))