git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/3] Add a second's delay to t7519 for untracked cache

From
Tao Klerks via GitGitGadget <gitgitgadget@gmail.com>
Date
Jun 24, 2021, 18:29 UTC
Message-ID
<c4d2a3cab4bd5243a776002e4f04fead7b1f34c5.1624559402.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.986.git.1624559401.gitgitgadget@gmail.com>
From: Tao Klerks <tao@klerks.biz>

In t7519 there is a test that writes files to disk, and immediately writes the untracked index. 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. We should do the same here.

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 <tao@klerks.biz>
---
 t/t7519-status-fsmonitor.sh | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/t/t7519-status-fsmonitor.sh b/t/t7519-status-fsmonitor.sh
index 637391c6ce4..1209fa93499 100755
--- a/t/t7519-status-fsmonitor.sh
+++ b/t/t7519-status-fsmonitor.sh
@@ -13,6 +13,10 @@ clean_repo () {
 	git clean -fd
 }
 
+avoid_racy() {
+	sleep 1
+}
+
 dirty_repo () {
 	: >untracked &&
 	: >dir1/untracked &&
@@ -332,6 +336,7 @@ test_expect_success UNTRACKED_CACHE 'ignore .git changes when invalidating UNTR'
 		: >dir2/modified &&
 		write_integration_script &&
 		git config core.fsmonitor .git/hooks/fsmonitor-test &&
+		avoid_racy &&
 		git update-index --untracked-cache &&
 		git update-index --fsmonitor &&
 		GIT_TRACE2_PERF="$TRASH_DIRECTORY/trace-before" \
-- 
gitgitgadget
Previous: Tao Klerks via GitGitGadgetNext: Junio C Hamano
Message 2 of 19 in “Empty untracked cache performance issue”
  1. 0/3 Empty untracked cache performance issueTao Klerks via GitGitGadget, Jun 24, 2021
  2. 1/3 Add a second's delay to t7519 for untracked cacheTao Klerks via GitGitGadget, Jun 24, 2021
  3. Junio C HamanoJun 29, 2021
  4. 2/3 In t7519, populate untracked cache before testTao Klerks via GitGitGadget, Jun 24, 2021
  5. 3/3 Write index when populating empty untracked cacheTao Klerks via GitGitGadget, Jun 24, 2021
  6. Junio C HamanoJun 29, 2021
  7. Tao KlerksFeb 24, 2022
  8. Junio C HamanoFeb 24, 2022
  9. 0/3 Empty untracked cache performance issueTao Klerks via GitGitGadget, Feb 25, 2022
  10. 1/3 t7519: avoid file to index mtime race for untracked cacheTao Klerks via GitGitGadget, Feb 25, 2022
  11. Junio C HamanoFeb 25, 2022
  12. Tao KlerksFeb 27, 2022
  13. 2/3 t7519: populate untracked cache before testTao Klerks via GitGitGadget, Feb 25, 2022
  14. 3/3 untracked-cache: write index when populating empty untracked cacheTao Klerks via GitGitGadget, Feb 25, 2022
  15. Junio C HamanoFeb 25, 2022
  16. 0/3 Empty untracked cache performance issueTao Klerks via GitGitGadget, Feb 27, 2022
  17. 1/3 t7519: avoid file to index mtime race for untracked cacheTao Klerks via GitGitGadget, Feb 27, 2022
  18. 2/3 t7519: populate untracked cache before testTao Klerks via GitGitGadget, Feb 27, 2022
  19. 3/3 untracked-cache: write index when populating empty untracked cacheTao Klerks via GitGitGadget, Feb 27, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.