Whether the working tree carries changes beyond the Git HEAD (unstaged or untracked content) — the CB-12A follow-up exact-separability oracle. A clean worktree at the boundary means the turn's recorded content equals the commit tree exactly (no remainder), so the verified capture's HEAD→index delta IS the recorded delta. Read-only; any git failure is conservatively a remainder (never claims exactn
(repo_root: &Path)
| 917 | /// HEAD→index delta IS the recorded delta. Read-only; any git failure is |
| 918 | /// conservatively a remainder (never claims exactness). |
| 919 | fn worktree_has_remainder(repo_root: &Path) -> bool { |
| 920 | // `--untracked-files=all` overrides a user's `status.showUntrackedFiles`; |
| 921 | // `--no-optional-locks` keeps the stat refresh from rewriting the index. |
| 922 | let Ok(output) = std::process::Command::new("git") |
| 923 | .args([ |
| 924 | "--no-optional-locks", |
| 925 | "status", |
| 926 | "--porcelain", |
| 927 | "--untracked-files=all", |
| 928 | ]) |
| 929 | .current_dir(repo_root) |
| 930 | .output() |
| 931 | else { |
| 932 | return true; |
| 933 | }; |
| 934 | if !output.status.success() { |
| 935 | return true; |
| 936 | } |
| 937 | // Atomic-owned state (.atomic/, .vault/) is never content remainder. |
| 938 | let stdout = String::from_utf8_lossy(&output.stdout).into_owned(); |
| 939 | let remainder_lines: Vec<&str> = stdout |
| 940 | .lines() |
| 941 | .filter(|line| { |
| 942 | let path = line.get(3..).unwrap_or(line); |
| 943 | !(path.starts_with(".atomic/") || path.starts_with(".vault/")) |
| 944 | }) |
| 945 | .collect(); |
| 946 | !remainder_lines.is_empty() |
| 947 | } |
| 948 | |
| 949 | /// Git's mode for a path that does not exist on one side of a diff. |
| 950 | const GIT_ABSENT_MODE: &str = "000000"; |