diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-11-15 16:37:49 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-11-15 16:37:49 -0800 |
commit | a25a2cd9eba530108a89a07cc8113d976bbdc4bd (patch) | |
tree | 2500157c4a17fee65f8a83bf9c83179a6e643e65 | |
parent | 14d52b28158ba7922adfc00ee488f934ef6d0593 (diff) | |
parent | 77e3efbf43a1060049121350cc3ae8c208e77d57 (diff) | |
download | git-a25a2cd9eba530108a89a07cc8113d976bbdc4bd.tar.gz git-a25a2cd9eba530108a89a07cc8113d976bbdc4bd.tar.xz |
Merge branch 'jc/receive-pack-auto' into maint
* jc/receive-pack-auto:
receive-pack: run "gc --auto --quiet" and optionally "update-server-info"
gc --auto --quiet: make the notice a bit less verboase
-rw-r--r-- | Documentation/config.txt | 9 | ||||
-rw-r--r-- | builtin-gc.c | 11 | ||||
-rw-r--r-- | builtin-receive-pack.c | 20 |
3 files changed, 36 insertions, 4 deletions
diff --git a/Documentation/config.txt b/Documentation/config.txt index cd1781498..ba6ed1080 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -1320,6 +1320,11 @@ rebase.stat:: Whether to show a diffstat of what changed upstream since the last rebase. False by default. +receive.autogc:: + By default, git-receive-pack will run "git-gc --auto" after + receiving data from git-push and updating refs. You can stop + it by setting this variable to false. + receive.fsckObjects:: If it is set to true, git-receive-pack will check all received objects. It will abort in the case of a malformed object or a @@ -1355,6 +1360,10 @@ receive.denyNonFastForwards:: even if that push is forced. This configuration variable is set when initializing a shared repository. +receive.updateserverinfo:: + If set to true, git-receive-pack will run git-update-server-info + after receiving data from git-push and updating refs. + remote.<name>.url:: The URL of a remote repository. See linkgit:git-fetch[1] or linkgit:git-push[1]. diff --git a/builtin-gc.c b/builtin-gc.c index 7d3e9cc7a..093517e39 100644 --- a/builtin-gc.c +++ b/builtin-gc.c @@ -216,10 +216,13 @@ int cmd_gc(int argc, const char **argv, const char *prefix) */ if (!need_to_gc()) return 0; - fprintf(stderr, "Auto packing your repository for optimum " - "performance. You may also\n" - "run \"git gc\" manually. See " - "\"git help gc\" for more information.\n"); + fprintf(stderr, + "Auto packing the repository for optimum performance.%s\n", + quiet + ? "" + : (" You may also\n" + "run \"git gc\" manually. See " + "\"git help gc\" for more information.")); } else append_option(argv_repack, prune_expire && !strcmp(prune_expire, "now") diff --git a/builtin-receive-pack.c b/builtin-receive-pack.c index b771fe9b2..e8bde02c2 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; } |