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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx>
---
 builtin-commit.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux