threads / patch / 18457

patchInvoke "git gc --auto" when a commit is successful.

Subject: [PATCH] Invoke "git gc --auto" when a commit is successful.

## tl;dr

3 messages between Mar 21, 2009 and Mar 21, 2009. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

David J. Mellor· Mar 21, 2009, 22:34 UTC · lore

This functionality was added to the previous git-commit.sh script in d4bb43e, but omitted when the script was ported to C in f5bbc32. This patch reinstates the functionality by copying the equivalent code that was introduced in builtin-merge.c in 1c7b76b.

Signed-off-by: David J. Mellor <dmellor@whistlingcat.com>
---
 builtin-commit.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
Show changes to builtin-commit.c +7 −0
diff --git a/builtin-commit.c b/builtin-commit.c
index 46e649c..780c142 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -1029,5 +1029,12 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 	if (!quiet)
 		print_summary(prefix, commit_sha1);
 
+	/*
+	 * Perform an automatic garbage collection if the commit was successful.
+	 * We ignore errors in 'gc --auto', since the user should see them.
+	 */
+	const char *argv_gc_auto[] = { "gc", "--auto", NULL };
+	run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
+
 	return 0;
 }
-- 
1.6.2.1
David J. Mellor· Mar 21, 2009, 23:37 UTC · re: Junio C Hamano · lore

Re: [PATCH] Invoke "git gc --auto" when a commit is successful.

On 03/21/2009 04:26 PM, Junio C Hamano wrote:
Show 5 quoted lines
> I do not think situation has changed since the previous round:
> 
>     http://thread.gmane.org/gmane.comp.version-control.git/78524/focus=82130
> 
> 

Thanks for the pointer. I had searched the list before coding this up, but somehow had missed this thread.

← back to recent threads