Function: project-try-vc
project-try-vc is a byte-compiled function defined in project.el.gz.
Signature
(project-try-vc DIR)
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/project.el.gz
(defun project-try-vc (dir)
(let* ((backend
;; FIXME: This is slow. Cache it.
(ignore-errors (vc-responsible-backend dir)))
(root
(pcase backend
('Git
;; Don't stop at submodule boundary.
;; FIXME: Cache for a shorter time.
(or (vc-file-getprop dir 'project-git-root)
(let ((root (vc-call-backend backend 'root dir)))
(vc-file-setprop
dir 'project-git-root
(if (and
;; FIXME: Invalidate the cache when the value
;; of this variable changes.
(project--vc-merge-submodules-p root)
(project--submodule-p root))
(let* ((parent (file-name-directory
(directory-file-name root))))
(vc-call-backend backend 'root parent))
root)))))
('nil nil)
(_ (ignore-errors (vc-call-backend backend 'root dir))))))
(and root (cons 'vc root))))