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

Method canonical_dot_dir

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

Resolve the **canonical** `.atomic` directory for a working path without* opening the database. If `path` is inside an agent sandbox, follows the `.atomic-sandbox` pointer to the canonical repository; otherwise finds the enclosing repository root. Returns ` /.atomic`. Use this for lock-free filesystem access to the canonical graph — e.g. writing a provenance graph through [`Change

(path: P)

Source from the content-addressed store, hash-verified

1131 /// sandbox `path/.atomic` is a throwaway local dir (or absent), so joining
1132 /// `.atomic` onto the working root would miss the real graph entirely.
1133 pub fn canonical_dot_dir<P: AsRef<Path>>(path: P) -> Result<PathBuf, RepositoryError> {
1134 if let Some((_working, canonical, _view)) = sandbox::detect_sandbox(path.as_ref()) {
1135 return Ok(working_copy::discover_layout(&canonical)?.common_dot_dir);
1136 }
1137 Ok(working_copy::discover_layout(path.as_ref())?.common_dot_dir)
1138 }
1139
1140 /// Resolve the canonical repository database path without opening redb.
1141 ///

Callers

nothing calls this directly

Calls 3

detect_sandboxFunction · 0.85
discover_layoutFunction · 0.85
as_refMethod · 0.80

Tested by

no test coverage detected