From: Marc Strapetz via GitGitGadget Date: Thu, 06 Jan 2022 22:34:57 GMT Subject: [PATCH v3 3/4] t7508: add tests capturing racy timestamp handling Message-ID: <3567ef91e7a91f4b0fc04884f0748c1f7a918a58.1641508499.git.gitgitgadget@gmail.com> In-Reply-To: From: Marc Strapetz "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 --- t/t7508-status.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/t/t7508-status.sh b/t/t7508-status.sh index b9efd2613d0..2b7ef6c41a4 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 -- gitgitgadget