Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

fix(tests): Add git gc to ensure deterministic ahead/behind after force push

Maximilian Roosfcffc29bf2f4
diff --git a/tests/integration_tests/list.rs b/tests/integration_tests/list.rs
index b5ddf7979..408bcb4ab 100644
--- a/tests/integration_tests/list.rs
+++ b/tests/integration_tests/list.rs
@@ -1715,12 +1715,12 @@ fn test_list_maximum_status_symbols() {
.output()
.unwrap();
- // Prune reflog to ensure deterministic ahead/behind calculation after force push.
- // Without this, the reflog may retain the old origin/feature reference (before force push),
- // causing git rev-list --left-right --count to calculate merge-base differently across platforms.
+ // Run git gc to ensure deterministic ahead/behind calculation after force push.
+ // Force pushes can leave stale references that affect merge-base calculation differently
+ // across platforms. Git gc cleans up unreachable objects and packs references.
let mut cmd = Command::new("git");
repo.configure_git_cmd(&mut cmd);
- cmd.args(["reflog", "expire", "--expire=now", "--all"])
+ cmd.args(["gc", "--prune=now"])
.current_dir(&feature)
.output()
.unwrap();