Fix CI failure: refresh index before checking working tree conflicts #515
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.
Fixes CI failure from commit bdf4351 (run 20873663585).
Problem
The test
test_list_full_working_tree_conflictswas failing in CI because theWorkingTreeConflictsTaskran before git's index was updated. This caused it to see the working tree as clean even though uncommitted changes existed, resulting in the conflict symbol showing↓(behind) instead of✗(conflicts).Root Cause
The commit bdf4351 introduced timing changes that made a pre-existing race condition more likely to occur. The
WorkingTreeConflictsTaskchecks if the working tree is dirty viagit status --porcelain, but without refreshing the index first, this can miss recently modified files due to "racy git" timing issues where file modifications within the same timestamp granularity aren't immediately detected.Solution
Cherry-picked the fix from commit f815fdf (which was created for a previous similar CI failure) that:
git update-index --refreshbefore checking if the working tree is dirtyThis fix was already proven to work in PR #516 (branch
fix/ci-20872461469) but hadn't been merged to main yet.Testing
test_list_full_working_tree_conflictsnow passesRelated