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

[PATCH v3] gc --auto: release pack files before auto packing

From
Kim Gybels <kgybels@infogroep.be>
Date
Jul 9, 2018, 20:37 UTC
Message-ID
<20180709203727.8236-1-kgybels@infogroep.be>
In-Reply-To
<20180704201600.9908-1-kgybels@infogroep.be>

Teach gc --auto to release pack files before auto packing the repository to prevent failures when removing them.

Also teach the test 'fetching with auto-gc does not lock up' to complain when it is no longer triggering an auto packing of the repository.

Fixes https://github.com/git-for-windows/git/issues/500
Signed-off-by: Kim Gybels <kgybels@infogroep.be>
---
Changes since v2:
- revert fix back to v1: use close_all_packs instead of repo_clear
- use test_i18ngrep only for translated string
 builtin/gc.c     | 1 +
 t/t5510-fetch.sh | 2 ++
 2 files changed, 3 insertions(+)
diff --git a/builtin/gc.c b/builtin/gc.c
index ccfb1ceaeb..63b62ab57c 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -612,6 +612,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
 		return -1;
 
 	if (!repository_format_precious_objects) {
+		close_all_packs(the_repository->objects);
 		if (run_command_v_opt(repack.argv, RUN_GIT_CMD))
 			return error(FAILED_RUN, repack.argv[0]);
 
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index e402aee6a2..6f1450eb69 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -828,9 +828,11 @@ test_expect_success 'fetching with auto-gc does not lock up' '
 	test_commit test2 &&
 	(
 		cd auto-gc &&
+		git config fetch.unpackLimit 1 &&
 		git config gc.autoPackLimit 1 &&
 		git config gc.autoDetach false &&
 		GIT_ASK_YESNO="$D/askyesno" git fetch >fetch.out 2>&1 &&
+		test_i18ngrep "Auto packing the repository" fetch.out &&
 		! grep "Should I try again" fetch.out
 	)
 '
-- 
2.18.0.windows.1
Previous: SZEDER Gábor
Message 11 of 11 in “gc --auto: release pack files before auto packing”
  1. gc --auto: release pack files before auto packingKim Gybels, Jun 30, 2018
  2. Duy NguyenJun 30, 2018
  3. Junio C HamanoJul 6, 2018
  4. SZEDER GáborJul 7, 2018
  5. Kim GybelsJul 7, 2018
  6. Duy NguyenJul 9, 2018
  7. Junio C HamanoJul 9, 2018
  8. Duy NguyenJul 11, 2018
  9. gc --auto: clear repository before auto packingKim Gybels, Jul 4, 2018
  10. SZEDER GáborJul 7, 2018
  11. gc --auto: release pack files before auto packingKim Gybels, Jul 9, 2018

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.