Subject: Re: [PATCH 3/7] pack-protocol.txt: Mark all LFs in push-cert as required

From: Junio C Hamano <[email-masked]>
Date: Mon, 06 Jul 2015 11:23:30 -0700

Junio C Hamano <[email-masked]> writes:

> By clarifying that "sender SHOULD terminate with LF, receiver MUST
> NOT require it" is the rule (and fixing the existing implementations
> at places where they violate the "MUST NOT" part, which I think are
> very small number of places), I think we can drop these LF (or LF?
> for that matter) from all of the PKT-LINE() in the construction in
> the pack-protocol.txt, which would be a very good thing to do.
>
> The example in your sentence will become PKT-LINE(foo SP bar) and
> the "there may be an LF at the end" would only be at one place, as a
> part of the definition of PKT-LINE().

I quickly scanned both the sources where we use packet_write() in
the code and say PKT-LINE in the doc; aside from the actual packfile
transfer that happens on the sideband, which technically _is_ a user
of PKT-LINE, we do not send anything that does not end with a text
in PKT-LINE.  I just wanted to make sure that "there may or may not
be an LF at the end; if there is, it is not part of the payload but
is part of the framing" does not invite new implementors to break
their binary transfer by reading the definition of PKT-LINE too
literally to mean "ok, so I stuffed this 998 byte binary gunk to the
packet and insert an optional LF before sending the remainder in
separate packets".

Thanks.