Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Strapetz <marc.strapetz@syntevo.com>2022-01-07 14:17:30 +0300
committerJunio C Hamano <gitster@pobox.com>2022-01-07 23:37:30 +0300
commit9b71efd01489d6c93436740e4c1b3eadeb0c719b (patch)
tree8ff4b3fc87e4fc681430252fac1ce1b6c765fdd4 /t/t7508-status.sh
parent0275e4daabed330c4d27cc9a482c2d23d7544aca (diff)
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>
Diffstat (limited to 't/t7508-status.sh')
-rwxr-xr-xt/t7508-status.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index b9efd2613d..2b7ef6c41a 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -1654,4 +1654,26 @@ test_expect_success '--no-optional-locks prevents index update' '
! 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