Skip to content

Commit cdaa4e9

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b725b27 commit cdaa4e9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

remote-curl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
error("remote needed");
952+
error("remote-curl: usage: git remote-curl <remote> [<url>]");
953953
return 1;
954954
}
955955

@@ -970,14 +970,14 @@ int main(int argc, const char **argv)
970970
do {
971971
if (strbuf_getline(&buf, stdin, '\n') == EOF) {
972972
if (ferror(stdin))
973-
error("error reading command stream");
973+
error("remote-curl: error reading command stream from git");
974974
return 1;
975975
}
976976
if (buf.len == 0)
977977
break;
978978
if (starts_with(buf.buf, "fetch ")) {
979979
if (nongit)
980-
die("Fetch attempted without a local repo");
980+
die("remote-curl: fetch attempted without a local repo");
981981
parse_fetch(&buf);
982982

983983
} else if (!strcmp(buf.buf, "list") || starts_with(buf.buf, "list ")) {
@@ -1014,7 +1014,7 @@ int main(int argc, const char **argv)
10141014
printf("\n");
10151015
fflush(stdout);
10161016
} else {
1017-
error("unknown command '%s'", buf.buf);
1017+
error("remote-curl: unknown command '%s' from git", buf.buf);
10181018
return 1;
10191019
}
10201020
strbuf_reset(&buf);

0 commit comments

Comments
 (0)