Function: projectile-repo-identity
projectile-repo-identity is a byte-compiled function defined in
projectile.el.
Signature
(projectile-repo-identity &optional PROJECT-ROOT)
Documentation
Return a plist identifying the repository PROJECT-ROOT is a checkout of.
The plist has two keys, either of which may be nil: :repo, the
directory every checkout of this very repository shares, and :remote,
a canonical identity for the upstream it was cloned from. See
projectile-same-repo-p for comparing two of these.
Returns nil for a project that isn't under a version control system Projectile can answer this for (only git, Mercurial and Jujutsu carry the notion), and for a remote project, where every probe would be a TRAMP round trip.
Results are cached in projectile-repo-identity-cache (cleared by
projectile-invalidate-cache).
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile-repo-identity (&optional project-root)
"Return a plist identifying the repository PROJECT-ROOT is a checkout of.
The plist has two keys, either of which may be nil: `:repo', the
directory every checkout of this very repository shares, and `:remote',
a canonical identity for the upstream it was cloned from. See
`projectile-same-repo-p' for comparing two of these.
Returns nil for a project that isn't under a version control system
Projectile can answer this for (only git, Mercurial and Jujutsu carry
the notion),
and for a remote project, where every probe would be a TRAMP round trip.
Results are cached in `projectile-repo-identity-cache' (cleared by
`projectile-invalidate-cache')."
(let ((root (or project-root (projectile-acquire-root))))
(unless (file-remote-p root)
(let ((cached (gethash root projectile-repo-identity-cache 'unset)))
(if (not (eq cached 'unset))
cached
(let ((identity (pcase (projectile-project-vcs root)
('git (projectile--git-repo-identity root))
('hg (projectile--hg-repo-identity root))
('jj (projectile--jj-repo-identity root)))))
;; An identity with nothing in it says as little as no identity
;; at all, and storing it as nil keeps the callers from having
;; to test both.
(if (not (or (plist-get identity :repo) (plist-get identity :remote)))
(setq identity nil)
;; The owner falls out of the remote, so derive it here rather
;; than in every backend.
(setq identity
(plist-put identity :owner
(projectile--repo-url-owner
(plist-get identity :remote)))))
(puthash root identity projectile-repo-identity-cache)
identity))))))