Function: vc-root-dir
vc-root-dir is an autoloaded and byte-compiled function defined in
vc.el.gz.
Signature
(vc-root-dir &optional BACKEND DIRECTORY)
Documentation
Return the root directory for the VC tree containing DIRECTORY.
Return nil if the root directory cannot be identified.
BACKEND is the VC backend.
DIRECTORY defaults to default-directory.
Source Code
;; Defined in /usr/src/emacs/lisp/vc/vc.el.gz
;;;###autoload
(defun vc-root-dir (&optional backend directory)
"Return the root directory for the VC tree containing DIRECTORY.
Return nil if the root directory cannot be identified.
BACKEND is the VC backend.
DIRECTORY defaults to `default-directory'."
(let ((default-directory (if directory (expand-file-name directory)
default-directory)))
(and-let* ((backend (or backend (vc-deduce-backend))))
(condition-case err
(vc-call-backend backend 'root default-directory)
(vc-not-supported
(unless (eq (error-slot-value err 1) 'root)
(signal err))
nil)))))