[PATCH] commit: resurrect "gc --auto" at the end

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Junio C Hamano <gitster@...>
Cc: <git@...>
Date: Wednesday, April 2, 2008 - 9:40 am

From: Johannes Schindelin <johannes.schindelin@gmx.de>

As the scripted version of git-commit did, we now call gc --auto just 
before the post-commit hook.

Any errors of gc --auto should be non-fatal, so we do not catch those; the 
user should see them anyway.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---

	Junio wrote:
	>
	>  * "git commit" used to have one [call to 'gc --auto'] at the 
	>    end in the scripted version, but seems to have lost it in C
	>    rewrite.

	How about this?

 builtin-commit.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/builtin-commit.c b/builtin-commit.c
index 660a345..bec62b2 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -863,6 +863,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 	char *nl, *p;
 	unsigned char commit_sha1[20];
 	struct ref_lock *ref_lock;
+	const char *argv_gc_auto[] = { "gc", "--auto", NULL };
 
 	git_config(git_commit_config);
 
@@ -987,6 +988,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 		     "not exceeded, and then \"git reset HEAD\" to recover.");
 
 	rerere();
+	/* We ignore errors in 'gc --auto', since the user should see them. */
+	run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
 	run_hook(get_index_file(), "post-commit", NULL);
 	if (!quiet)
 		print_summary(prefix, commit_sha1);
-- 
1.5.5.rc2.30.gf2056

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] git gc --auto: defer on battery, Miklos Vajna, (Sun Mar 30, 7:14 pm)
Re: [PATCH] git gc --auto: defer on battery, Brandon Casey, (Mon Mar 31, 12:24 pm)
Re: [PATCH] git gc --auto: defer on battery, Miklos Vajna, (Mon Mar 31, 1:38 pm)
Re: [PATCH] git gc --auto: defer on battery, Brandon Casey, (Mon Mar 31, 2:31 pm)
Re: [PATCH] git gc --auto: defer on battery, Johannes Schindelin, (Sun Mar 30, 7:41 pm)
Re: [PATCH] git gc --auto: defer on battery, Miklos Vajna, (Sun Mar 30, 7:53 pm)
Re: [PATCH] git gc --auto: defer on battery, Björn, (Sun Mar 30, 7:26 pm)
Re: [PATCH] git gc --auto: defer on battery, Linus Torvalds, (Sun Mar 30, 7:46 pm)
Re: [PATCH] git gc --auto: defer on battery, Joey Hess, (Mon Mar 31, 2:08 pm)
[PATCH 4/4] templates: add an example pre-auto-gc hook, Miklos Vajna, (Mon Mar 31, 5:37 am)
Re: [PATCH 4/4] templates: add an example pre-auto-gc hook, Brian Gernhardt, (Mon Mar 31, 2:30 pm)
[PATCH 3/4] Documentation/hooks: add pre-auto-gc hook, Miklos Vajna, (Mon Mar 31, 5:36 am)
[PATCH 1/4] git-gc --auto: add pre-auto-gc hook, Miklos Vajna, (Mon Mar 31, 5:35 am)
[PATCH 0/4] add pre-auto-gc hook for git-gc --auto, Miklos Vajna, (Mon Mar 31, 5:35 am)
Re: [PATCH] git gc --auto: defer on battery, Junio C Hamano, (Sun Mar 30, 10:06 pm)
[PATCH] commit: resurrect "gc --auto" at the end, Johannes Schindelin, (Wed Apr 2, 9:40 am)
Re: [PATCH] commit: resurrect "gc --auto" at the end, Johannes Schindelin, (Wed May 14, 11:07 am)
Re: [PATCH] commit: resurrect "gc --auto" at the end, Junio C Hamano, (Wed May 14, 2:13 pm)
Re: [PATCH] commit: resurrect "gc --auto" at the end, Holger Schurig, (Thu May 15, 2:44 am)
Re: [PATCH] commit: resurrect "gc --auto" at the end, Johannes Schindelin, (Wed May 14, 2:40 pm)
Re: [PATCH] git gc --auto: defer on battery, Linus Torvalds, (Mon Mar 31, 11:02 am)
Re: [PATCH] git gc --auto: defer on battery, Björn, (Mon Mar 31, 12:43 pm)
fetchmail (Re: [PATCH] git gc --auto: defer on battery), Linus Torvalds, (Mon Mar 31, 1:00 pm)
Re: [PATCH] git gc --auto: defer on battery, Björn, (Sun Mar 30, 8:00 pm)
[PATCH] git gc --auto: defer on battery, Miklos Vajna, (Sun Mar 30, 7:39 pm)
Re: [PATCH] git gc --auto: defer on battery, Björn, (Sun Mar 30, 7:55 pm)