MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / find_root

Method find_root

atomic-repository/src/repository/mod.rs:1105–1112  ·  view source on GitHub ↗

Find the repository root by searching for .atomic directory. Starts at the given path and walks up to parent directories until a `.atomic` directory is found that contains a repository database (`atomic.redb`, or the legacy `pristine.redb`), distinguishing it from a config directory like `~/.atomic/`. The search stops at the user's home directory to prevent accidentally treating the entire home

(start: &Path)

Source from the content-addressed store, hash-verified

1103 /// The search stops at the user's home directory to prevent accidentally
1104 /// treating the entire home directory as a repository.
1105 pub fn find_root(start: &Path) -> Result<PathBuf, RepositoryError> {
1106 // Service resolution is a path-only lookup. Preserve dev's sandbox
1107 // discovery while also recognizing #207's linked worktree layouts.
1108 if let Some((working_root, _, _)) = sandbox::detect_sandbox(start) {
1109 return Ok(working_root);
1110 }
1111 working_copy::discover_layout(start).map(|layout| layout.working_root)
1112 }
1113
1114 // ── Path accessors ──────────────────────────────────────────────────
1115

Callers

nothing calls this directly

Calls 2

detect_sandboxFunction · 0.85
discover_layoutFunction · 0.85

Tested by

no test coverage detected