fetch-pack: show clearer error message upon ERR
authorJonathan Tan <jonathantanmy@google.com>
Wed, 12 Apr 2017 18:06:02 +0000 (11:06 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Apr 2017 01:51:28 +0000 (18:51 -0700)
commit8e2c7bef034f0712c6db776974ee4b40f1150a56
tree25374441886d2f25ab5cdeb9d4785b692b5aff25
parent49800c940790cc7465d1b03e08d472ffd8684808
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 <jonathantanmy@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/technical/pack-protocol.txt
fetch-pack.c