Skip to content

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

fix(test): add sleep for Windows mtime detection in working tree conflicts test (#485)

claude[bot]3d118202016c
diff --git a/tests/integration_tests/list.rs b/tests/integration_tests/list.rs
index 9f1fbd583..a4e2be46e 100644
--- a/tests/integration_tests/list.rs
+++ b/tests/integration_tests/list.rs
@@ -2197,14 +2197,33 @@ 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();
+ // On Windows, git's mtime-based change detection may need a moment to see the file change
+ // due to lower timestamp resolution (especially in CI environments)
+ #[cfg(target_os = "windows")]
+ std::thread::sleep(std::time::Duration::from_millis(100));
+
// 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)
+ // Without this, git's mtime-based caching can miss the change on fast filesystems (especially macOS/Windows)
repo.git_command()
.args(["update-index", "--refresh"])
.current_dir(&feature)
.output()
.unwrap();
+ // Verify git sees the change (especially important on Windows)
+ let status_output = repo
+ .git_command()
+ .args(["status", "--porcelain"])
+ .current_dir(&feature)
+ .output()
+ .unwrap();
+ let status_str = String::from_utf8(status_output.stdout).unwrap();
+ assert!(
+ !status_str.trim().is_empty(),
+ "Git should detect the modified file. Status output: {:?}",
+ status_str
+ );
+
// Without --full: no conflict symbol (only checks commit-level)
assert_cmd_snapshot!(
"working_tree_conflicts_without_full",