git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "David J. Mellor" <dmellor@whistlingcat.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org
Subject: [PATCH] Invoke "git gc --auto" when a commit is successful.
Date: Sat, 21 Mar 2009 15:34:54 -0700	[thread overview]
Message-ID: <1237674894-8151-1-git-send-email-dmellor@whistlingcat.com> (raw)

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(-)

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

             reply	other threads:[~2009-03-21 22:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-21 22:34 David J. Mellor [this message]
2009-03-21 23:26 ` [PATCH] Invoke "git gc --auto" when a commit is successful Junio C Hamano
2009-03-21 23:37   ` David J. Mellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1237674894-8151-1-git-send-email-dmellor@whistlingcat.com \
    --to=dmellor@whistlingcat.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).