From: Jeff King Date: Thu, 27 Sep 2012 21:36:02 GMT Subject: Re: Using bitmaps to accelerate fetch and clone Message-ID: <20120927213602.GA12512@sigill.intra.peff.net> In-Reply-To: <7vfw63p2wi.fsf@alter.siamese.dyndns.org> On Thu, Sep 27, 2012 at 02:33:01PM -0700, Junio C Hamano wrote: > Jeff King writes: > > > So yeah, we would want to put the pack trailer sha1 into the > > supplementary index file, and check that it matches when we open it. > > It's a slight annoyance, but it's O(1). > > Yes. If I am not mistaken, that is exactly how an .idx file makes > sure that it describes the matching .pack file (it has packfile > checksum in its trailer). Otherwise you can repack the same set of > objects into a new .pack file and make existing .idx very confused. Yeah. In theory you wouldn't name the new packfile into place without also generating a new index for it. But even if you do it right, there's a race condition, and checking the trailer sha1 at least lets us know that they don't match (I assume we just reject the index, then; I guess this can result in an operation failing, but in practice it doesn't really happen, as we don't bother packing unless there are actually new objects). -Peff