On Fri, Oct 31, 2014 at 02:48:17PM -0700, Junio C Hamano wrote:

> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to