summaryrefslogtreecommitdiff
path: root/builtin/archive.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-02-08 18:47:49 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-02-08 20:37:30 (GMT)
commitbc9d4dc5b07c05c7b26a4e781b7538db7c775fc3 (patch)
treef4d1f0c00e6c5b463fd6e548ae4f53ec0f55f37f /builtin/archive.c
parent8279ed033f703d4115bee620dccd32a9ec94d9aa (diff)
downloadgit-bc9d4dc5b07c05c7b26a4e781b7538db7c775fc3.zip
git-bc9d4dc5b07c05c7b26a4e781b7538db7c775fc3.tar.gz
git-bc9d4dc5b07c05c7b26a4e781b7538db7c775fc3.tar.bz2
correct error messages for NULL packet_read_line()
The packet_read_line() function dies if it gets an unexpected EOF. It only returns NULL if we get a flush packet (or technically, a zero-length "0004" packet, but nobody is supposed to send those, and they are indistinguishable from a flush in this interface). Let's correct error messages which claim an unexpected EOF; it's really an unexpected flush packet. While we're here, let's also check "!line" instead of "!len" in the second case. The two events should always coincide, but checking "!line" makes it more obvious that we are not about to dereference NULL. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/archive.c')
-rw-r--r--builtin/archive.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/archive.c b/builtin/archive.c
index f863465..73971d0 100644
--- a/builtin/archive.c
+++ b/builtin/archive.c
@@ -55,7 +55,7 @@ static int run_remote_archiver(int argc, const char **argv,
buf = packet_read_line(fd[0], NULL);
if (!buf)
- die(_("git archive: expected ACK/NAK, got EOF"));
+ die(_("git archive: expected ACK/NAK, got a flush packet"));
if (strcmp(buf, "ACK")) {
if (starts_with(buf, "NACK "))
die(_("git archive: NACK %s"), buf + 5);