Subject: [PATCH 1/2] receive-pack: update $GIT_DIR/info before auto garbage collection

From: Nguyễn Thái Ngọc Duy <[email-masked]>
Date: Tue, 4 Feb 2014 13:52:44 +0700

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 <[email-masked]>
---
 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);
 		run_update_post_hook(commands);
+		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);
 		clear_shallow_info(&si);
 	}
 	if (use_sideband)
-- 
1.8.5.2.240.g8478abd