test(migration): initialize shallow origin on main

The shallow-backup fixture populated refs/heads/main but left the bare repository HEAD on Git's configurable default branch. In clean Nix builds that default is master, so clone succeeded as an empty repository and never wrote the shallow marker the test requires.

Initialize the fixture explicitly on main so HEAD names the populated branch and the depth-one clone deterministically exercises shallow migration behavior. Production migration code is unchanged.

Validation: cargo fmt --check; cargo test -p ngit-grasp --lib shallow_legacy_backup_waits_for_family_closure.

Assisted-by: Codex (GPT-5)
This commit is contained in:
DanConwayDev
2026-09-10 08:46:18 +00:00
parent b990d2189b
commit ef3a11a62e
+7 -1
View File
@@ -2172,7 +2172,13 @@ mod tests {
let origin = temp.path().join("origin.git");
git(
temp.path(),
&["init", "--bare", "--quiet", origin.to_str().unwrap()],
&[
"init",
"--bare",
"--quiet",
"--initial-branch=main",
origin.to_str().unwrap(),
],
);
let parent = write_commit_object(&origin, None);
let child = write_commit_object(&origin, Some(&parent));