mojombo/grit — pull request #103 by peff (2011-12-23 08:23:30+00:00)
Title: support large packfiles with index v2

Grit has known about the "v2" pack index format for a while.
However, it never actually handled the extended offsets that
we get when indexing packfiles that are larger than 2
gigabytes.

When an object is at an offset smaller than 2G, its byte
offset into the packfile is placed in the first table of
4-byte offset values. If it's past that, then the MSB is set
on its offset in the 4-byte table, and the rest of the
4-byte integer specifies an offset into an 8-byte table that
follows.

With this patch, grit should handle arbitrarily large packs
(limited only by the pack format itself).

A few notes on the patch itself:

- I unpack using two "N" formats instead of "Q>", because
"Q>" is not available in ruby < 1.9.3

- No automated test is included, because you need a
packfile that is greater than 2G. I did test it by hand.