pack-protocol: clarify LF-handling in PKT-LINE()
The spec is very inconsistent about which PKT-LINE() parts of the grammar include a LF. On top of that, the code is not consistent, either (e.g., send-pack does not put newlines into the ref-update commands it sends). Let's make explicit the long-standing expectation that we generally expect pkt-lines to end in a newline, but that receivers should be lenient. This makes the spec consistent, and matches what git already does (though it does not always fulfill the SHOULD). We do make an exception for the push-cert, where the receiving code is currently a bit pickier. This is a reasonable way to be, as the data needs to be byte-for-byte compatible with what was signed. We _could_ make up some rules about signing a canonicalized version including newlines, but that would require a code change, and is out of scope for this patch. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
16ffa6443e
commit
1c9b659d98
@ -62,7 +62,10 @@ A pkt-line MAY contain binary data, so implementors MUST ensure
|
||||
pkt-line parsing/formatting routines are 8-bit clean.
|
||||
|
||||
A non-binary line SHOULD BE terminated by an LF, which if present
|
||||
MUST be included in the total length.
|
||||
MUST be included in the total length. Receivers MUST treat pkt-lines
|
||||
with non-binary data the same whether or not they contain the trailing
|
||||
LF (stripping the LF if present, and not complaining when it is
|
||||
missing).
|
||||
|
||||
The maximum length of a pkt-line's data component is 65520 bytes.
|
||||
Implementations MUST NOT send pkt-line whose length exceeds 65524
|
||||
|
Reference in New Issue
Block a user