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

[PATCH v2 2/5] index-pack: perform automatic gc, share receive.gc config with receive-pack

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
May 16, 2012, 12:29 UTC
Message-ID
<1337171377-26960-3-git-send-email-pclouds@gmail.com>
In-Reply-To
<1337171377-26960-1-git-send-email-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Documentation/config.txt |    7 ++++---
 builtin/index-pack.c     |    6 ++++--
 2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 915cb5a..3b6d773 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1754,9 +1754,10 @@ rebase.autosquash::
 	If set to true enable '--autosquash' option by default.
 
 receive.autogc::
-	By default, git-receive-pack will run "git-gc --auto" after
-	receiving data from git-push and updating refs.  You can stop
-	it by setting this variable to false.
+	By default, git-receive-pack and git-index-pack will run
+	"git-gc --auto" after receiving data from git-push and
+	updating refs.  You can stop it by setting this variable to
+	false.
 
 receive.fsckObjects::
 	If it is set to true, git-receive-pack will check all received
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index dc2cfe6..4e888ea 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -10,6 +10,7 @@
 #include "fsck.h"
 #include "exec_cmd.h"
 #include "thread-utils.h"
+#include "gc.h"
 
 static const char index_pack_usage[] =
 "git index-pack [-v] [-o <index-file>] [--keep | --keep=<msg>] [--verify] [--strict] (<pack-file> | --stdin [--fix-thin] [<pack-file>])";
@@ -1463,12 +1464,13 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
 	curr_index = write_idx_file(index_name, idx_objects, nr_objects, &opts, pack_sha1);
 	free(idx_objects);
 
-	if (!verify)
+	if (!verify) {
 		final(pack_name, curr_pack,
 		      index_name, curr_index,
 		      keep_name, keep_msg,
 		      pack_sha1);
-	else
+		gc("receive.autogc", 0);
+	} else
 		close(input_fd);
 	free(objects);
 	free(index_name_buf);
-- 
1.7.8.36.g69ee2
Previous: Nguyen Thai Ngoc DuyNext: Nguyễn Thái Ngọc Duy
Message 14 of 17 in “Update "gc" behavior in commit, merge, am, rebase and index-pack”
  1. Update "gc" behavior in commit, merge, am, rebase and index-packNguyễn Thái Ngọc Duy, May 12, 2012
  2. Nguyen Thai Ngoc DuyMay 12, 2012
  3. Nicolas PitreMay 12, 2012
  4. Nguyen Thai Ngoc DuyMay 14, 2012
  5. Sverre RabbelierMay 14, 2012
  6. Nguyen Thai Ngoc DuyMay 15, 2012
  7. Jeff KingMay 14, 2012
  8. Jeff KingMay 14, 2012
  9. Junio C HamanoMay 14, 2012
  10. 0/5 "git gc --auto" updateNguyễn Thái Ngọc Duy, May 16, 2012
  11. 1/5 Add convenient function to do automatic garbage collectionNguyễn Thái Ngọc Duy, May 16, 2012
  12. Junio C HamanoMay 18, 2012
  13. Nguyen Thai Ngoc DuyMay 19, 2012
  14. 2/5 index-pack: perform automatic gc, share receive.gc config with receive-packNguyễn Thái Ngọc Duy, May 16, 2012
  15. 3/5 commit: reinstate "gc --auto"Nguyễn Thái Ngọc Duy, May 16, 2012
  16. 4/5 gc: add --dry-runNguyễn Thái Ngọc Duy, May 16, 2012
  17. 5/5 Update "gc" behavior in commit, merge, am and rebaseNguyễn Thái Ngọc Duy, May 16, 2012

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.