Skip to content

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

fix(test): use git update-index instead of sleep for macOS compatibility (#460)

claude[bot]84dbe7f19d35
diff --git a/tests/integration_tests/list.rs b/tests/integration_tests/list.rs
index fc5db2eb0..9f1fbd583 100644
--- a/tests/integration_tests/list.rs
+++ b/tests/integration_tests/list.rs
@@ -2197,10 +2197,13 @@ fn test_list_full_working_tree_conflicts(mut repo: TestRepo) {
// Now add uncommitted changes to feature that would conflict with main
std::fs::write(feature.join("shared.txt"), "feature's uncommitted version").unwrap();
- // Sleep briefly to avoid racy git index caching issues on macOS
- // Git compares mtimes, and if the write happens within the same filesystem time
- // resolution window as the previous commit, git status may not detect the change.
- std::thread::sleep(std::time::Duration::from_millis(10));
+ // Force git to refresh its index to detect the file modification immediately
+ // Without this, git's mtime-based caching can miss the change on fast filesystems (especially macOS)
+ repo.git_command()
+ .args(["update-index", "--refresh"])
+ .current_dir(&feature)
+ .output()
+ .unwrap();
// Without --full: no conflict symbol (only checks commit-level)
assert_cmd_snapshot!(