receive-pack: send auto-gc output over sideband 2
Redirect auto-gc output to the sideband such that it is visible to all clients. As a side effect, all auto-gc error messages are now prefixed with "remote: " before being printed to stderr on the client-side which makes it easier to understand that those error messages originate from the server. Signed-off-by: Lukas Fleischer <lfleischer@lfos.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Lukas Fleischer committed
Jun 5, 2016 at 11:36 UTC
860a2ebecd26563e6ac0f89c90052b41a17d1703
1 file changed
+13
-2
builtin/receive-pack.c
+13
-2
@@ -1788,9 +1788,20 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
1788
const char *argv_gc_auto[] = {
1789
"gc", "--auto", "--quiet", NULL,
1790
};
1791
- int opt = RUN_GIT_CMD | RUN_COMMAND_STDOUT_TO_STDERR;
1791
+ struct child_process proc = CHILD_PROCESS_INIT;
1792
+
1793
+ proc.no_stdin = 1;
1794
+ proc.stdout_to_stderr = 1;
1795
+ proc.err = use_sideband ? -1 : 0;
1796
+ proc.git_cmd = 1;
1797
+ proc.argv = argv_gc_auto;
1798
+
1799
close_all_packs();
1793
- run_command_v_opt(argv_gc_auto, opt);
1800
+ if (!start_command(&proc)) {
1801
+ if (use_sideband)
1802
+ copy_to_sideband(proc.err, -1, NULL);
1803
+ finish_command(&proc);
1804
+ }
1805
}
1806
if (auto_update_server_info)
1807
update_server_info(0);