remote-curl: mark helper-protocol errors more clearly
When we encounter an error in remote-curl, we generally just report it to stderr. There is no need for the user to care that the "could not connect to server" error was generated by git-remote-https rather than a function in the parent git-fetch process. However, when the error is in the protocol between git and the helper, it makes sense to clearly identify which side is complaining. These cases shouldn't ever happen, but when they do, we can make them less confusing by being more verbose. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Jul 9, 2014 at 17:47 UTC
cdaa4e98ca56586f78a455bd624457248347a56d
1 file changed
+4
-4
remote-curl.c
+4
-4
@@ -949,7 +949,7 @@ int main(int argc, const char **argv)
949
git_extract_argv0_path(argv[0]);
950
setup_git_directory_gently(&nongit);
951
if (argc < 2) {
952
- error("remote needed");
952
+ error("remote-curl: usage: git remote-curl <remote> [<url>]");
953
return 1;
954
}
955
@@ -970,14 +970,14 @@ int main(int argc, const char **argv)
970
do {
971
if (strbuf_getline(&buf, stdin, '\n') == EOF) {
972
if (ferror(stdin))
973
- error("error reading command stream");
973
+ error("remote-curl: error reading command stream from git");
974
return 1;
975
}
976
if (buf.len == 0)
977
break;
978
if (starts_with(buf.buf, "fetch ")) {
979
if (nongit)
980
- die("Fetch attempted without a local repo");
980
+ die("remote-curl: fetch attempted without a local repo");
981
parse_fetch(&buf);
982
983
} else if (!strcmp(buf.buf, "list") || starts_with(buf.buf, "list ")) {
@@ -1014,7 +1014,7 @@ int main(int argc, const char **argv)
1014
printf("\n");
1015
fflush(stdout);
1016
} else {
1017
- error("unknown command '%s'", buf.buf);
1017
+ error("remote-curl: unknown command '%s' from git", buf.buf);
1018
return 1;
1019
}
1020
strbuf_reset(&buf);