Fix CI: replace sleep with git update-index for macOS test #460
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The
test_list_full_working_tree_conflictstest was failing on macOS in CI (run 20766920768).The test expected to see
!✗(modified + conflict) in the status column, but was seeing↓(behind) instead. This happened because git's index cache wasn't detecting the file modification, even with the 10ms sleep added in commit ca0d27f.Root Cause
Git uses mtime comparisons to detect file changes for performance. When a file is written and then
git statusis called very quickly:The 10ms sleep was insufficient on macOS CI runners because:
Solution
Replace the sleep with an explicit
git update-index --refreshcall after the file write. This forces git to immediately re-scan the working tree and detect the modification, regardless of mtime values.This is the standard git pattern for ensuring index consistency in tests.
Testing
Related
🤖 This is an automated fix for human review