Skip to content

Commit d2617eb

Browse files
committed
Merge branch 'jt/fetch-pack-error-reporting'
"git fetch-pack" was not prepared to accept ERR packet that the upload-pack can send with a human-readable error message. It showed the packet contents with ERR prefix, so there was no data loss, but it was redundant to say "ERR" in an error message. * jt/fetch-pack-error-reporting: fetch-pack: show clearer error message upon ERR
2 parents b30cf67 + 8e2c7be commit d2617eb

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Documentation/technical/pack-protocol.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,14 +351,19 @@ ACK after 'done' if there is at least one common base and multi_ack or
351351
multi_ack_detailed is enabled. The server always sends NAK after 'done'
352352
if there is no common base found.
353353

354+
Instead of 'ACK' or 'NAK', the server may send an error message (for
355+
example, if it does not recognize an object in a 'want' line received
356+
from the client).
357+
354358
Then the server will start sending its packfile data.
355359

356360
----
357-
server-response = *ack_multi ack / nak
361+
server-response = *ack_multi ack / nak / error-line
358362
ack_multi = PKT-LINE("ACK" SP obj-id ack_status)
359363
ack_status = "continue" / "common" / "ready"
360364
ack = PKT-LINE("ACK" SP obj-id)
361365
nak = PKT-LINE("NAK")
366+
error-line = PKT-LINE("ERR" SP explanation-text)
362367
----
363368

364369
A simple clone may look like this (with no 'have' lines):

fetch-pack.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ static enum ack_type get_ack(int fd, unsigned char *result_sha1)
276276
return ACK;
277277
}
278278
}
279+
if (skip_prefix(line, "ERR ", &arg))
280+
die(_("remote error: %s"), arg);
279281
die(_("git fetch-pack: expected ACK/NAK, got '%s'"), line);
280282
}
281283

0 commit comments

Comments
 (0)