Skip to content

Commit 0ac7443

Browse files
committed
Merge branch 'jk/remote-curl-squelch-extra-errors'
* jk/remote-curl-squelch-extra-errors: remote-curl: mark helper-protocol errors more clearly remote-curl: use error instead of fprintf(stderr) remote-curl: do not complain on EOF from parent git
2 parents 19a249b + cdaa4e9 commit 0ac7443

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

remote-curl.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ static curlioerr rpc_ioctl(CURL *handle, int cmd, void *clientp)
399399
rpc->pos = 0;
400400
return CURLIOE_OK;
401401
}
402-
fprintf(stderr, "Unable to rewind rpc post data - try increasing http.postBuffer\n");
402+
error("unable to rewind rpc post data - try increasing http.postBuffer");
403403
return CURLIOE_FAILRESTART;
404404

405405
default:
@@ -709,7 +709,7 @@ static int fetch_dumb(int nr_heads, struct ref **to_fetch)
709709
free(targets[i]);
710710
free(targets);
711711

712-
return ret ? error("Fetch failed.") : 0;
712+
return ret ? error("fetch failed.") : 0;
713713
}
714714

715715
static int fetch_git(struct discovery *heads,
@@ -949,7 +949,7 @@ int main(int argc, const char **argv)
949949
git_extract_argv0_path(argv[0]);
950950
setup_git_directory_gently(&nongit);
951951
if (argc < 2) {
952-
fprintf(stderr, "Remote needed\n");
952+
error("remote-curl: usage: git remote-curl <remote> [<url>]");
953953
return 1;
954954
}
955955

@@ -972,16 +972,14 @@ int main(int argc, const char **argv)
972972

973973
if (strbuf_getline(&buf, stdin, '\n') == EOF) {
974974
if (ferror(stdin))
975-
fprintf(stderr, "Error reading command stream\n");
976-
else
977-
fprintf(stderr, "Unexpected end of command stream\n");
975+
error("remote-curl: error reading command stream from git");
978976
return 1;
979977
}
980978
if (buf.len == 0)
981979
break;
982980
if (starts_with(buf.buf, "fetch ")) {
983981
if (nongit)
984-
die("Fetch attempted without a local repo");
982+
die("remote-curl: fetch attempted without a local repo");
985983
parse_fetch(&buf);
986984

987985
} else if (!strcmp(buf.buf, "list") || starts_with(buf.buf, "list ")) {
@@ -1017,7 +1015,7 @@ int main(int argc, const char **argv)
10171015
printf("\n");
10181016
fflush(stdout);
10191017
} else {
1020-
fprintf(stderr, "Unknown command '%s'\n", buf.buf);
1018+
error("remote-curl: unknown command '%s' from git", buf.buf);
10211019
return 1;
10221020
}
10231021
strbuf_reset(&buf);

0 commit comments

Comments
 (0)