Function: projectile-project-vcs

projectile-project-vcs is a byte-compiled function defined in projectile.el.

Signature

(projectile-project-vcs &optional PROJECT-ROOT)

Documentation

Determine the VCS used by the project if any.

PROJECT-ROOT is the targeted directory. If nil, use the variable projectile-project-root(var)/projectile-project-root(fun).

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260310.858/projectile.el
(defun projectile-project-vcs (&optional project-root)
  "Determine the VCS used by the project if any.
PROJECT-ROOT is the targeted directory.  If nil, use
the variable `projectile-project-root'."
  (or project-root (setq project-root (projectile-acquire-root)))
  (cond
   ;; first we check for a VCS marker in the project root itself
   ((projectile-file-exists-p (expand-file-name ".git" project-root)) 'git)
   ((projectile-file-exists-p (expand-file-name ".hg" project-root)) 'hg)
   ((projectile-file-exists-p (expand-file-name ".fslckout" project-root)) 'fossil)
   ((projectile-file-exists-p (expand-file-name "_FOSSIL_" project-root)) 'fossil)
   ((projectile-file-exists-p (expand-file-name ".bzr" project-root)) 'bzr)
   ((projectile-file-exists-p (expand-file-name "_darcs" project-root)) 'darcs)
   ((projectile-file-exists-p (expand-file-name ".pijul" project-root)) 'pijul)
   ((projectile-file-exists-p (expand-file-name ".svn" project-root)) 'svn)
   ((projectile-file-exists-p (expand-file-name ".sl" project-root)) 'sapling)
   ((projectile-file-exists-p (expand-file-name ".jj" project-root)) 'jj)
   ;; then we check if there's a VCS marker up the directory tree
   ;; that covers the case when a project is part of a multi-project repository
   ;; in those cases you can still use the VCS to get a list of files for
   ;; the project in question
   ((projectile-locate-dominating-file project-root ".git") 'git)
   ((projectile-locate-dominating-file project-root ".hg") 'hg)
   ((projectile-locate-dominating-file project-root ".fslckout") 'fossil)
   ((projectile-locate-dominating-file project-root "_FOSSIL_") 'fossil)
   ((projectile-locate-dominating-file project-root ".bzr") 'bzr)
   ((projectile-locate-dominating-file project-root "_darcs") 'darcs)
   ((projectile-locate-dominating-file project-root ".pijul") 'pijul)
   ((projectile-locate-dominating-file project-root ".svn") 'svn)
   ((projectile-locate-dominating-file project-root ".sl") 'sapling)
   ((projectile-locate-dominating-file project-root ".jj") 'jj)
   (t 'none)))