From 8e2c7bef034f0712c6db776974ee4b40f1150a56 Mon Sep 17 00:00:00 2001 From: Jonathan Tan Date: Wed, 12 Apr 2017 11:06:02 -0700 Subject: fetch-pack: show clearer error message upon ERR Currently, fetch-pack prints a confusing error message ("expected ACK/NAK") when the server it's communicating with sends a pkt-line starting with "ERR". Replace it with a less confusing error message. Also update the documentation describing the fetch-pack/upload-pack protocol (pack-protocol.txt) to indicate that "ERR" can be sent in the place of "ACK" or "NAK". In practice, this has been done for quite some time by other Git implementations (e.g. JGit sends "want $id not valid") and by Git itself (since commit bdb31ea: "upload-pack: report "not our ref" to client", 2017-02-23) whenever a "want" line references an object that it does not have. (This is uncommon, but can happen if a repository is garbage-collected during a negotiation.) Signed-off-by: Jonathan Tan Reviewed-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- fetch-pack.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'fetch-pack.c') diff --git a/fetch-pack.c b/fetch-pack.c index f12bfcdbb1..986b1efebc 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -240,6 +240,8 @@ static enum ack_type get_ack(int fd, unsigned char *result_sha1) return ACK; } } + if (skip_prefix(line, "ERR ", &arg)) + die(_("remote error: %s"), arg); die(_("git fetch-pack: expected ACK/NAK, got '%s'"), line); } -- cgit v1.2.1