Function: magit-auto-revert-repository-buffer-p
magit-auto-revert-repository-buffer-p is a byte-compiled function
defined in magit-autorevert.el.
Signature
(magit-auto-revert-repository-buffer-p BUFFER &optional FALLBACK)
Documentation
Return non-nil if BUFFER visits a file inside the current repository.
The current repository is the one containing default-directory.
If there is no current repository, then return FALLBACK (which
defaults to nil) for any BUFFER.
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-autorevert.el
(defun magit-auto-revert-repository-buffer-p (buffer &optional fallback)
"Return non-nil if BUFFER visits a file inside the current repository.
The current repository is the one containing `default-directory'.
If there is no current repository, then return FALLBACK (which
defaults to nil) for any BUFFER."
;; Call `magit-toplevel' just once per cycle.
(unless (and magit-auto-revert-toplevel
(= (cdr magit-auto-revert-toplevel)
magit-auto-revert-counter))
(require 'magit-process)
(setq magit-auto-revert-toplevel
(cons (or (magit-toplevel) 'no-repo)
magit-auto-revert-counter)))
(let ((top (car magit-auto-revert-toplevel)))
(if (eq top 'no-repo)
fallback
(let ((dir (buffer-local-value 'default-directory buffer)))
(and (equal (file-remote-p dir)
(file-remote-p top))
;; ^ `tramp-handle-file-in-directory-p' lacks this optimization.
(file-in-directory-p dir top))))))