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)
| 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 |