mirror of
https://github.com/git/git
synced 2024-09-12 21:04:12 +00:00
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 <marc.strapetz@syntevo.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
0275e4daab
commit
9b71efd014
|
@ -1654,4 +1654,26 @@ test_expect_success '--no-optional-locks prevents index update' '
|
||||||
! test_is_magic_mtime .git/index
|
! test_is_magic_mtime .git/index
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'racy timestamps will be fixed for clean worktree' '
|
||||||
|
echo content >racy-dirty &&
|
||||||
|
echo content >racy-racy &&
|
||||||
|
git add racy* &&
|
||||||
|
git commit -m "racy test files" &&
|
||||||
|
# let status rewrite the index, if necessary; after that we expect
|
||||||
|
# no more index writes unless caused by racy timestamps; note that
|
||||||
|
# timestamps may already be racy now (depending on previous tests)
|
||||||
|
git status &&
|
||||||
|
test_set_magic_mtime .git/index &&
|
||||||
|
git status &&
|
||||||
|
! test_is_magic_mtime .git/index
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'racy timestamps will be fixed for dirty worktree' '
|
||||||
|
echo content2 >racy-dirty &&
|
||||||
|
git status &&
|
||||||
|
test_set_magic_mtime .git/index &&
|
||||||
|
git status &&
|
||||||
|
! test_is_magic_mtime .git/index
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
Loading…
Reference in a new issue