Overlay Git-informed classifications onto native status output. This never mutates durable tracking. It only adjusts what native status displays* for paths whose Git index relation differs from durable tracking, so the golden §9.2 rows hold without conflating layers: - index stage-0 paths that are not durably tracked are displayed as `Added` with an explicit "staged via Git index" detail; - inde
(
repo: &Repository,
repo_root: &Path,
status: &mut atomic_repository::RepositoryStatus,
)
| 424 | /// - index stages 1-3 (unmerged) are displayed as `Conflicted` with a |
| 425 | /// Git merge detail. |
| 426 | pub(crate) fn apply_git_informed_overlays( |
| 427 | repo: &Repository, |
| 428 | repo_root: &Path, |
| 429 | status: &mut atomic_repository::RepositoryStatus, |
| 430 | ) -> CliResult<()> { |
| 431 | // Git-informed overlays are colocated shim behavior (RFC §9); native |
| 432 | // status of a working copy that never enrolled stays Git-independent. |
| 433 | if !repo_root.join(".git").exists() |
| 434 | || !repo.shim_workspace_active().map_err(CliError::Repository)? |
| 435 | { |
| 436 | return Ok(()); |
| 437 | } |
| 438 | let git_repo = open_git(repo_root)?; |
| 439 | let policy = conversion_policy(&git_repo)?; |
| 440 | let index = atomic_repository::observe_git_index(repo_root, &policy).map_err(|error| { |
| 441 | CliError::GitError { |
| 442 | message: error.to_string(), |
| 443 | } |
| 444 | })?; |
| 445 | |
| 446 | let durably_tracked: std::collections::BTreeSet<String> = repo |
| 447 | .list_tracked_files() |
| 448 | .map_err(|e| CliError::Internal(e.into()))? |
| 449 | .iter() |
| 450 | .filter(|file| !file.is_directory) |
| 451 | .map(|file| atomic_repository::canonical_path_identity(&file.path.to_string_lossy())) |
| 452 | .collect(); |
| 453 | |
| 454 | let mut unmerged = Vec::new(); |
| 455 | let mut stage_zero_indexed = std::collections::BTreeSet::new(); |
| 456 | for entry in &index.entries { |
| 457 | if entry.stage == 0 { |
| 458 | stage_zero_indexed.insert(entry.path.clone()); |
| 459 | } else { |
| 460 | unmerged.push(entry.path.clone()); |
| 461 | } |
| 462 | } |
| 463 | unmerged.sort(); |
| 464 | unmerged.dedup(); |
| 465 | |
| 466 | // Index-new paths displayed as pending additions (Git-index tracking). |
| 467 | for path in &stage_zero_indexed { |
| 468 | // Canonicalize the raw index side once; stored identities already |
| 469 | // escape literal '%' and must not alias their decoded lookalikes. |
| 470 | if durably_tracked.contains(&path.escaped()) { |
| 471 | continue; |
| 472 | } |
| 473 | let mut entry = atomic_repository::FileStatusEntry::new( |
| 474 | path.to_native().map_err(|error| CliError::GitError { |
| 475 | message: error.to_string(), |
| 476 | })?, |
| 477 | atomic_repository::FileStatus::Added, |
| 478 | ); |
| 479 | entry.set_details( |
| 480 | "staged in Git index; not durably tracked (run `atomic add` for durable tracking)" |
| 481 | .to_string(), |
| 482 | ); |
| 483 | status.add_or_replace_entry(entry); |
no test coverage detected