summaryrefslogtreecommitdiff
path: root/remote-curl.c
diff options
context:
space:
mode:
authorSverre Rabbelier <srabbelier@gmail.com>2011-07-16 15:03:29 +0200
committerJunio C Hamano <gitster@pobox.com>2011-07-19 11:17:47 -0700
commit1843f0ce4d31e3c37f7d07dd1d13f6fb034ac2b0 (patch)
treef68233423dd9b783f6a012ea5df264aec77d47fb /remote-curl.c
parente173587252ea0db16efc5c64c2cb165ccb406495 (diff)
downloadgit-1843f0ce4d31e3c37f7d07dd1d13f6fb034ac2b0.tar.gz
remote-curl: accept empty line as terminator
This went unnoticed because the transport helper infrastructore did not check the return value of the helper, nor did the helper print anything before exiting. While at it also make sure that the stream doesn't end unexpectedly. Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote-curl.c')
-rw-r--r--remote-curl.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/remote-curl.c b/remote-curl.c
index 17d8a9b377..7b3c113b09 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -855,7 +855,14 @@ int main(int argc, const char **argv)
http_init(remote);
do {
- if (strbuf_getline(&buf, stdin, '\n') == EOF)
+ if (strbuf_getline(&buf, stdin, '\n') == EOF) {
+ if (ferror(stdin))
+ fprintf(stderr, "Error reading command stream\n");
+ else
+ fprintf(stderr, "Unexpected end of command stream\n");
+ return 1;
+ }
+ if (buf.len == 0)
break;
if (!prefixcmp(buf.buf, "fetch ")) {
if (nongit)
@@ -895,6 +902,7 @@ int main(int argc, const char **argv)
printf("\n");
fflush(stdout);
} else {
+ fprintf(stderr, "Unknown command '%s'\n", buf.buf);
return 1;
}
strbuf_reset(&buf);