Auto gc could take a long time, and it's optional. "git push" user
should be allowed to stop the program if they don't want to wait. Move
server update step before auto gc. So we're ready to die any time
since auto gc is kicked off.

Signed-off-by: Nguyễn Thái Ngọc Duy <>
 builtin/receive-pack.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 85bba35..82e2f76 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1208,6 +1208,8 @@ int cmd_receive_pack(int argc, const char **argv, const 
char *prefix)
                        report(commands, unpack_status);
                run_receive_hook(commands, "post-receive", 1);
+               if (auto_update_server_info)
+                       update_server_info(0);
                if (auto_gc) {
                        const char *argv_gc_auto[] = {
                                "gc", "--auto", "--quiet", NULL,
@@ -1215,8 +1217,6 @@ int cmd_receive_pack(int argc, const char **argv, const 
char *prefix)
                        int opt = RUN_GIT_CMD | RUN_COMMAND_STDOUT_TO_STDERR;
                        run_command_v_opt(argv_gc_auto, opt);
-               if (auto_update_server_info)
-                       update_server_info(0);
        if (use_sideband)

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to