Skip to content

Commit 9b71efd

Browse files
mstrapgitster
authored andcommitted
t7508: add tests capturing racy timestamp handling
"git status" fixes racy timestamps regardless of the worktree being dirty or not. The new test cases capture this behavior. Signed-off-by: Marc Strapetz <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0275e4d commit 9b71efd

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

t/t7508-status.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,4 +1654,26 @@ test_expect_success '--no-optional-locks prevents index update' '
16541654
! test_is_magic_mtime .git/index
16551655
'
16561656

1657+
test_expect_success 'racy timestamps will be fixed for clean worktree' '
1658+
echo content >racy-dirty &&
1659+
echo content >racy-racy &&
1660+
git add racy* &&
1661+
git commit -m "racy test files" &&
1662+
# let status rewrite the index, if necessary; after that we expect
1663+
# no more index writes unless caused by racy timestamps; note that
1664+
# timestamps may already be racy now (depending on previous tests)
1665+
git status &&
1666+
test_set_magic_mtime .git/index &&
1667+
git status &&
1668+
! test_is_magic_mtime .git/index
1669+
'
1670+
1671+
test_expect_success 'racy timestamps will be fixed for dirty worktree' '
1672+
echo content2 >racy-dirty &&
1673+
git status &&
1674+
test_set_magic_mtime .git/index &&
1675+
git status &&
1676+
! test_is_magic_mtime .git/index
1677+
'
1678+
16571679
test_done

0 commit comments

Comments
 (0)