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

[PATCH] t5510: run auto-gc in the foreground

From
SZEDER Gábor <szeder@ira.uka.de>
Date
May 1, 2016, 15:37 UTC
Message-ID
<20160501153743.323-1-szeder@ira.uka.de>

The last test added to 't5510-fetch' in 0898c9628104 (fetch: release pack files before garbage-collecting, 2016-01-13) may sporadically trigger following error message from the test harness:

  rm: cannot remove 'trash directory.t5510-fetch/auto-gc/.git': Directory not empty

The test in question forces an auto-gc, which, if the system supports it, runs in the background by default, and occasionally takes long enough for the test to finish and for 'test_done' to start housekeeping. This can lead to the test's 'git gc --auto' in the background and 'test_done's 'rm -rf $trash' in the foreground racing each other to create and delete files and directories. It might just happen that 'git gc' re-creates a directory that 'rm -rf' already visited and removed, which ultimately triggers the above error.

Disable detaching the auto-gc process to ensure that it finishes before the test can continue, thus avoiding this racy situation.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
 t/t5510-fetch.sh | 1 +
 1 file changed, 1 insertion(+)
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 38321d19efbe..454d896390c0 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -682,6 +682,7 @@ test_expect_success 'fetching with auto-gc does not lock up' '
 	(
 		cd auto-gc &&
 		git config gc.autoPackLimit 1 &&
+		git config gc.autoDetach false &&
 		GIT_ASK_YESNO="$D/askyesno" git fetch >fetch.out 2>&1 &&
 		! grep "Should I try again" fetch.out
 	)
-- 
2.8.2.356.ge684b1d
Next: Johannes Schindelin
Message 1 of 9 in “t5510: run auto-gc in the foreground”
  1. t5510: run auto-gc in the foregroundSZEDER Gábor, May 1, 2016
  2. Johannes SchindelinMay 2, 2016
  3. SZEDER GáborMay 2, 2016
  4. SZEDER GáborMay 3, 2016
  5. Johannes SchindelinMay 4, 2016
  6. SZEDER GáborMay 5, 2016
  7. gc --auto: don't lie about running in background on WindowsSZEDER Gábor, May 5, 2016
  8. Junio C HamanoMay 5, 2016
  9. SZEDER GáborMay 7, 2016

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.