Skip to content

Commit c096955

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Acked-by: Sverre Rabbelier <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 81d340d commit c096955

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

t/t5801-remote-helpers.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ test_expect_success 'proper failure checks for pushing' '
182182
cd local &&
183183
test_must_fail git push --all 2> error &&
184184
cat error &&
185-
grep -q "Reading from remote helper failed" error
185+
grep -q "Reading from helper .git-remote-testgit. failed" error
186186
)
187187
'
188188

transport-helper.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ static void sendline(struct helper_data *helper, struct strbuf *buffer)
4646
die_errno("Full write to remote helper failed");
4747
}
4848

49-
static int recvline_fh(FILE *helper, struct strbuf *buffer)
49+
static int recvline_fh(FILE *helper, struct strbuf *buffer, const char *name)
5050
{
5151
strbuf_reset(buffer);
5252
if (debug)
5353
fprintf(stderr, "Debug: Remote helper: Waiting...\n");
5454
if (strbuf_getline(buffer, helper, '\n') == EOF) {
5555
if (debug)
5656
fprintf(stderr, "Debug: Remote helper quit.\n");
57-
die("Reading from remote helper failed");
57+
die("Reading from helper 'git-remote-%s' failed", name);
5858
}
5959

6060
if (debug)
@@ -64,7 +64,7 @@ static int recvline_fh(FILE *helper, struct strbuf *buffer)
6464

6565
static int recvline(struct helper_data *helper, struct strbuf *buffer)
6666
{
67-
return recvline_fh(helper->out, buffer);
67+
return recvline_fh(helper->out, buffer, helper->name);
6868
}
6969

7070
static void xchgline(struct helper_data *helper, struct strbuf *buffer)
@@ -536,7 +536,7 @@ static int process_connect_service(struct transport *transport,
536536
goto exit;
537537

538538
sendline(data, &cmdbuf);
539-
recvline_fh(input, &cmdbuf);
539+
recvline_fh(input, &cmdbuf, name);
540540
if (!strcmp(cmdbuf.buf, "")) {
541541
data->no_disconnect_req = 1;
542542
if (debug)

0 commit comments

Comments
 (0)