Junio C Hamano <[email protected]> writes:
>> I am moderately negative about this; wouldn't it make the end result
>> cleaner to fix the implementation?
>
> I think that something like this should be sufficient. As the
> receiving end, we must not complain if there is no terminator.
> ...
And the change we are *not* going to make, but I made temporarily
only for testing, on the sending side to violate our "sender SHOULD
terminate with LF" rule would look like this:
There is a slight complication on sending an empty line without any
termination, though ;-) The reader that calls packet_read() cannot
tell such a payload from a flush packet, I think.
*That* may be something we want to document.
diff --git a/send-pack.c b/send-pack.c
index 2a64fec..1a743db 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -273,9 +273,11 @@ static int generate_push_cert(struct strbuf *req_buf,
packet_buf_write(req_buf, "push-cert%c%s", 0, cap_string);
for (cp = cert.buf; cp < cert.buf + cert.len; cp = np) {
+ int len;
np = next_line(cp, cert.buf + cert.len - cp);
+ len = (np <= cp + 1) ? 1 : (np - cp - 1);
packet_buf_write(req_buf,
- "%.*s", (int)(np - cp), cp);
+ "%.*s", len, cp);
}
packet_buf_write(req_buf, "push-cert-end\n");
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html