Skip to content

Commit a67d178

Browse files
TaoKgitster
authored andcommitted
t7519: avoid file to index mtime race for untracked cache
In t7519 there is a test that writes files to disk, and immediately writes the index with the untracked cache. Because of mtime-comparison logic that uses a 1-second resolution, this means the cached entries are not trusted/used under some circumstances (see read-cache.c#is_racy_stat()). Untracked cache tests in t7063 use a 1-second delay to avoid this issue, but we don't want to introduce arbitrary slowdowns, so instead use test-tool chmtime to backdate the files slightly. The t7063 delays are a #leftoverbit, to be worked on in a separate series. This change doesn't actually affect the outcome of the test, but does enhance its validity, and becomes relevant after later changes. Signed-off-by: Tao Klerks <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent dab1b79 commit a67d178

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

t/t7519-status-fsmonitor.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,13 +324,19 @@ test_expect_success UNTRACKED_CACHE 'ignore .git changes when invalidating UNTR'
324324
cd dot-git &&
325325
mkdir -p .git/hooks &&
326326
: >tracked &&
327+
test-tool chmtime =-60 tracked &&
327328
: >modified &&
329+
test-tool chmtime =-60 modified &&
328330
mkdir dir1 &&
329331
: >dir1/tracked &&
332+
test-tool chmtime =-60 dir1/tracked &&
330333
: >dir1/modified &&
334+
test-tool chmtime =-60 dir1/modified &&
331335
mkdir dir2 &&
332336
: >dir2/tracked &&
337+
test-tool chmtime =-60 dir2/tracked &&
333338
: >dir2/modified &&
339+
test-tool chmtime =-60 dir2/modified &&
334340
write_integration_script &&
335341
git config core.fsmonitor .git/hooks/fsmonitor-test &&
336342
git update-index --untracked-cache &&

0 commit comments

Comments
 (0)