git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] receive-pack: send auto-gc output over sideband 2

From
Lukas Fleischer <lfleischer@lfos.de>
Date
Jun 5, 2016, 09:36 UTC
Message-ID
<20160605093638.16533-1-lfleischer@lfos.de>
In-Reply-To
<146489432847.688.11121862368709034386@typhoon>

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>
---
 builtin/receive-pack.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index a744437..15c323a 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1775,9 +1775,20 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
 			const char *argv_gc_auto[] = {
 				"gc", "--auto", "--quiet", NULL,
 			};
-			int opt = RUN_GIT_CMD | RUN_COMMAND_STDOUT_TO_STDERR;
+			struct child_process proc = CHILD_PROCESS_INIT;
+
+			proc.no_stdin = 1;
+			proc.stdout_to_stderr = 1;
+			proc.err = use_sideband ? -1 : 0;
+			proc.git_cmd = 1;
+			proc.argv = argv_gc_auto;
+
 			close_all_packs();
-			run_command_v_opt(argv_gc_auto, opt);
+			if (!start_command(&proc)) {
+				if (use_sideband)
+					copy_to_sideband(proc.err, -1, NULL);
+				finish_command(&proc);
+			}
 		}
 		if (auto_update_server_info)
 			update_server_info(0);
-- 
2.8.3
Previous: Jeff King
Message 9 of 9 in “Mark remote `gc --auto` error messages”
  1. Lukas FleischerJun 2, 2016
  2. Junio C HamanoJun 2, 2016
  3. Lukas FleischerJun 2, 2016
  4. Junio C HamanoJun 2, 2016
  5. Jeff KingJun 2, 2016
  6. Junio C HamanoJun 2, 2016
  7. Jeff KingJun 2, 2016
  8. Jeff KingJun 2, 2016
  9. receive-pack: send auto-gc output over sideband 2Lukas Fleischer, Jun 5, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.