pub fn discover(worktree_root: &Path) -> Result<RepoLayout, DiscoverError>Expand description
Resolve the RepoLayout for the repository whose working tree is
rooted at worktree_root (#493 Phase 1 discovery).
.mkitis a directory, or absent: the classic single-worktree layout (RepoLayout::single) — absence is NOT an error here so the store-open path keeps producing today’s “not a repository” diagnostics unchanged..mkitis a FILE: a linked worktree. The pointer is parsed (mkitdir: <path>, absolute or relative toworktree_root), the per-tree state dir must exist, and the common dir is resolved via the state dir’scommondirfile (defaulting to../..when the file is absent, matching whatworktree addwrites) and must exist. Every failure along that chain is a typed, fail-closedDiscoverError— a broken linked tree must never silently degrade into “operate on some other directory”.
§Errors
See DiscoverError.