Re: [PATCH] use child_process_init() to initialize struct child_process variables
- From
Jeff King <peff@peff.net>
- Date
- Nov 1, 2014, 03:33 UTC
- Message-ID
- <20141101033327.GA8307@peff.net>
- In-Reply-To
- <xmqqvbmzsyfy.fsf@gitster.dls.corp.google.com>
On Fri, Oct 31, 2014 at 02:48:17PM -0700, Junio C Hamano wrote:
Show 9 quoted lines
> Programs that read a pack data stream unpack-objects were originally > designed to ignore cruft after the pack data stream ends, and > because the bundle file format ends with pack data stream, you > should have been able to append extra information at the end without > breaking older clients. Alas, this principle is still true for > unpack-objects, but index-pack broke it fairly early on, and we use > the latter to deal with bundles, so we cannot just tuck extra info > at the end of an existing bundle. You'd instead need a new option > to create a bundle that cannot be read by existing clients X-<.
I think you could use a similar NUL-trick to what we do in the online protocol, and have a ref section like:
...sha1... refs/heads/master ...sha1... refs/heads/confused-with-master ...sha1... HEAD\0symref=refs/heads/master
The current parser reads into a strbuf up to the newline, but we ignore everything after the NUL, treating it like a C string. Prior to using strbufs, we used fgets, which behaves similarly (you could not know from fgets that there is extra data after the NUL, but that is OK; we only want older versions to ignore the data, not do anything useful with it).
-Peff