This makes the two commands to call "git gc --auto" when they are done. I earlier said that obvious candidates also include merge and rebase, but these are lot less frequent operations compared to add, and more importantly, in a normal workflow they would almost always happen after "git fetch" is done. In other words, if you are downstream developer, the automatic invocation in "git fetch" will take care of things for you, and otherwise if you do not have an upstream, you would be doing your own development, so "git add" to add your changes will take care of the auto invocation for you. Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> --- * This is obviously a follow-up to the previous one that allows you to say "git gc --auto". I somewhat feel dirty about calling cmd_gc() bypassing fork & exec from "git add", though... builtin-add.c | 2 ++ git-fetch.sh | 1 + 2 files changed, 3 insertions(+), 0 deletions(-) diff --git a/builtin-add.c b/builtin-add.c index 105a9f0..8431c16 100644 --- a/builtin-add.c +++ b/builtin-add.c @@ -263,9 +263,11 @@ int cmd_add(int argc, const char **argv, const char *prefix) finish: if (active_cache_changed) { + const char *args[] = { "gc", "--auto", NULL }; if (write_cache(newfd, active_cache, active_nr) || close(newfd) || commit_locked_index(&lock_file)) die("Unable to write new index file"); + cmd_gc(2, args, NULL); } return 0; diff --git a/git-fetch.sh b/git-fetch.sh index c3a2001..86050eb 100755 --- a/git-fetch.sh +++ b/git-fetch.sh @@ -375,3 +375,4 @@ case "$orig_head" in fi ;; esac +git gc --auto -- 1.5.3.1.840.g0fedbc - 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