pub fn ensure_clone(canonical_url: &str) -> Result<PathBuf, CacheError>Expand description
Ensure a local clone of canonical_url exists and is up to date; returns
the repo’s local path.
Fetches into the existing slot if one already proves itself owned
(is_owned_entry); otherwise clones fresh into a private staging
directory, enforces the per-clone size cap, and only then moves it into
the addressable cache slot. Returns CacheError::UnsafeToReplace if a
non-owned directory already occupies the cache-key path, and
CacheError::CloneTooLarge if the clone/fetch exceeds
digest_cache_clone_max_bytes. Runs LRU eviction over the rest of the
cache after a successful clone/fetch (this clone is exempt from its own
eviction pass). See crates/khive-pack-git/docs/api/cache.md#ensure_clone for
the staging-then-move and ownership-guard rationale.