transport-helper: mention helper name when it dies

When we try to read from a remote-helper and get EOF or an error, we print a message indicating that the helper died. However, users may not know that a remote helper was in use (e.g., when using git-over-http), or even what a remote helper is. Let's print the name of the helper (e.g., "git-remote-https"); this makes it more obvious what the program is for, and provides a useful token for reporting bugs or searching for more information (e.g., in manpages). Signed-off-by: Jeff King <peff@peff.net> Acked-by: Sverre Rabbelier <srabbelier@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Apr 10, 2013 at 17:16 UTC c096955c5bb8e20186cc7c07d4d12b77ddcd01c6
2 files changed +5 -5
t/t5801-remote-helpers.sh
+1 -1
@@ -182,7 +182,7 @@ test_expect_success 'proper failure checks for pushing' '
182 cd local &&
183 test_must_fail git push --all 2> error &&
184 cat error &&
185 - grep -q "Reading from remote helper failed" error
185 + grep -q "Reading from helper .git-remote-testgit. failed" error
186 )
187 '
188
transport-helper.c
+4 -4
@@ -46,7 +46,7 @@ static void sendline(struct helper_data *helper, struct strbuf *buffer)
46 die_errno("Full write to remote helper failed");
47 }
48
49 -static int recvline_fh(FILE *helper, struct strbuf *buffer)
49 +static int recvline_fh(FILE *helper, struct strbuf *buffer, const char *name)
50 {
51 strbuf_reset(buffer);
52 if (debug)
@@ -54,7 +54,7 @@ static int recvline_fh(FILE *helper, struct strbuf *buffer)
54 if (strbuf_getline(buffer, helper, '\n') == EOF) {
55 if (debug)
56 fprintf(stderr, "Debug: Remote helper quit.\n");
57 - die("Reading from remote helper failed");
57 + die("Reading from helper 'git-remote-%s' failed", name);
58 }
59
60 if (debug)
@@ -64,7 +64,7 @@ static int recvline_fh(FILE *helper, struct strbuf *buffer)
64
65 static int recvline(struct helper_data *helper, struct strbuf *buffer)
66 {
67 - return recvline_fh(helper->out, buffer);
67 + return recvline_fh(helper->out, buffer, helper->name);
68 }
69
70 static void xchgline(struct helper_data *helper, struct strbuf *buffer)
@@ -536,7 +536,7 @@ static int process_connect_service(struct transport *transport,
536 goto exit;
537
538 sendline(data, &cmdbuf);
539 - recvline_fh(input, &cmdbuf);
539 + recvline_fh(input, &cmdbuf, name);
540 if (!strcmp(cmdbuf.buf, "")) {
541 data->no_disconnect_req = 1;
542 if (debug)