Expand description
Discovering canonical repos by scanning Config::workdir instead of requiring them to be
cloned by rq or listed by hand.
scan() walks the tree recursively, stopping at the first repo found in each branch (a repo’s
own subdirectories - submodules, vendored trees, nested worktrees - are never canonical repos
themselves). A directory is a repo if it has a .jj/repo directory (jj, colocated or not -
checked first so a colocated git+jj repo counts as jj) or a .git directory (git). A
.jj/repo file (a secondary jj workspace add workspace) or a .git file (a git
worktree) means “not canonical, don’t descend either” - the real repo lives elsewhere and
will be found from its own position in the tree.
Every remote is read and normalized (crate::repo::normalize_url), so any URL form
(https://, git@host:, ssh://) matches. A repo with no remotes at all can’t be matched
against anything a review reports, so it’s dropped rather than cached. name - the id used to
match a review’s repo against this one - is origin’s normalized URL, or the first remote if
there’s no origin, so it stays stable regardless of which alias a review happens to report.
The scan result is cached (WorkdirCache) so it isn’t re-run on every rq fetch; see
RepoStore::resolve for the rescan-on-miss policy.
Structs§
Functions§
- scan
- Recursively scan
rootfor canonical repos, skippingskip(rq’s own data dir, so tool-managed clones never get picked up as if they were user checkouts) and any dot-directory. Errors reading a directory (permissions, races) are treated as “nothing here”, not fatal - a workdir scan shouldn’t abort over one unreadable subdirectory.