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

Method from_git_head

atomic-repository/src/repository/project_tree.rs:325–337  ·  view source on GitHub ↗

Auto-detect from the Git HEAD tree: does the tracked root tree hold a `.vault` entry? An unborn or detached-without-commit HEAD reads as untracked.

(git: &git2::Repository)

Source from the content-addressed store, hash-verified

323 /// a `.vault` entry? An unborn or detached-without-commit HEAD reads
324 /// as untracked.
325 fn from_git_head(git: &git2::Repository) -> Self {
326 let tracks_vault = git
327 .head()
328 .ok()
329 .and_then(|head| head.peel_to_commit().ok())
330 .and_then(|commit| commit.tree().ok())
331 .is_some_and(|tree| tree.get_name(".vault").is_some());
332 if tracks_vault {
333 Self::IncludeVault
334 } else {
335 Self::ShimPrivate
336 }
337 }
338}
339
340/// Whether `path` is Atomic-private shim state (`.atomic*`): tracked alive

Callers

nothing calls this directly

Calls 3

treeMethod · 0.80
okMethod · 0.45
headMethod · 0.45

Tested by

no test coverage detected