Skip to content

Commit

Permalink
remote-curl: use error instead of fprintf(stderr)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Jul 10, 2014
1 parent 37943e4 commit b725b27
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions remote-curl.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ static curlioerr rpc_ioctl(CURL *handle, int cmd, void *clientp)
rpc->pos = 0;
return CURLIOE_OK;
}
fprintf(stderr, "Unable to rewind rpc post data - try increasing http.postBuffer\n");
error("unable to rewind rpc post data - try increasing http.postBuffer");
return CURLIOE_FAILRESTART;

default:
Expand Down Expand Up @@ -709,7 +709,7 @@ static int fetch_dumb(int nr_heads, struct ref **to_fetch)
free(targets[i]);
free(targets);

return ret ? error("Fetch failed.") : 0;
return ret ? error("fetch failed.") : 0;
}

static int fetch_git(struct discovery *heads,
Expand Down Expand Up @@ -949,7 +949,7 @@ int main(int argc, const char **argv)
git_extract_argv0_path(argv[0]);
setup_git_directory_gently(&nongit);
if (argc < 2) {
fprintf(stderr, "Remote needed\n");
error("remote needed");
return 1;
}

Expand All @@ -970,7 +970,7 @@ int main(int argc, const char **argv)
do {
if (strbuf_getline(&buf, stdin, '\n') == EOF) {
if (ferror(stdin))
fprintf(stderr, "Error reading command stream\n");
error("error reading command stream");
return 1;
}
if (buf.len == 0)
Expand Down Expand Up @@ -1014,7 +1014,7 @@ int main(int argc, const char **argv)
printf("\n");
fflush(stdout);
} else {
fprintf(stderr, "Unknown command '%s'\n", buf.buf);
error("unknown command '%s'", buf.buf);
return 1;
}
strbuf_reset(&buf);
Expand Down

0 comments on commit b725b27

Please sign in to comment.