diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-10-20 14:56:40 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-10-21 15:32:32 -0700 |
commit | 77e3efbf43a1060049121350cc3ae8c208e77d57 (patch) | |
tree | 862e5120e12f3422903822f2f86eb3bbb238f35a /builtin-receive-pack.c | |
parent | gc --auto --quiet: make the notice a bit less verboase (diff) | |
download | tgif-77e3efbf43a1060049121350cc3ae8c208e77d57.tar.xz |
receive-pack: run "gc --auto --quiet" and optionally "update-server-info"
Introduce two new configuration variables, receive.autogc (defaults to
true) and receive.updateserverinfo (defaults to false). When these are
set, receive-pack runs "gc --auto --quiet" and "update-server-info"
respectively after it finishes receiving data from "git push" and updating
refs.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Diffstat (limited to 'builtin-receive-pack.c')
-rw-r--r-- | builtin-receive-pack.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/builtin-receive-pack.c b/builtin-receive-pack.c index b771fe9b20..e8bde02c27 100644 --- a/builtin-receive-pack.c +++ b/builtin-receive-pack.c @@ -28,6 +28,8 @@ static int transfer_unpack_limit = -1; static int unpack_limit = 100; static int report_status; static int prefer_ofs_delta = 1; +static int auto_update_server_info; +static int auto_gc = 1; static const char *head_name; static char *capabilities_to_send; @@ -88,6 +90,16 @@ static int receive_pack_config(const char *var, const char *value, void *cb) return 0; } + if (strcmp(var, "receive.updateserverinfo") == 0) { + auto_update_server_info = git_config_bool(var, value); + return 0; + } + + if (strcmp(var, "receive.autogc") == 0) { + auto_gc = git_config_bool(var, value); + return 0; + } + return git_default_config(var, value, cb); } @@ -672,6 +684,14 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix) report(unpack_status); run_receive_hook(post_receive_hook); run_update_post_hook(commands); + if (auto_gc) { + const char *argv_gc_auto[] = { + "gc", "--auto", "--quiet", NULL, + }; + run_command_v_opt(argv_gc_auto, RUN_GIT_CMD); + } + if (auto_update_server_info) + update_server_info(0); } return 0; } |