Skip to content

Commit b725b27

Browse files
peffgitster
authored andcommitted
remote-curl: use error instead of fprintf(stderr)
We usually prefix our error messages with "error: ", but many error messages from remote-curl are simply printed with fprintf. This can make the output a little harder to read (especially because such message may be intermingled with errors from the parent git process). There is no reason to avoid error(), as we are already calling it many places (in addition to libgit.a functions which use it). While we're adjusting the messages, we can also drop the capitalization which makes them unlike other git error messages. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 37943e4 commit b725b27

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

remote-curl.c

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

402402
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 needed");
953953
return 1;
954954
}
955955

@@ -970,7 +970,7 @@ int main(int argc, const char **argv)
970970
do {
971971
if (strbuf_getline(&buf, stdin, '\n') == EOF) {
972972
if (ferror(stdin))
973-
fprintf(stderr, "Error reading command stream\n");
973+
error("error reading command stream");
974974
return 1;
975975
}
976976
if (buf.len == 0)
@@ -1014,7 +1014,7 @@ int main(int argc, const char **argv)
10141014
printf("\n");
10151015
fflush(stdout);
10161016
} else {
1017-
fprintf(stderr, "Unknown command '%s'\n", buf.buf);
1017+
error("unknown command '%s'", buf.buf);
10181018
return 1;
10191019
}
10201020
strbuf_reset(&buf);

0 commit comments

Comments
 (0)