Re: [PATCH 2/2] bundle: default to SHA1 when reading bundle headers
- From
Jeff King <peff@peff.net>
- Date
- Aug 13, 2024, 11:24 UTC
- Message-ID
- <20240813112434.GA968816@coredump.intra.peff.net>
- In-Reply-To
- <7e15c3daf95283f62030fe7b5dd0bbf8e467881a.1723540604.git.ps@pks.im>
On Tue, Aug 13, 2024 at 11:18:15AM +0200, Patrick Steinhardt wrote:
Show 9 quoted lines
> This is only a symptom of a deeper issue though. Bundles default to the > SHA1 object format unless they advertise an "@object-format=" header. > Consequently, it has been wrong in the first place to use the object > format used by the current repository when parsing bundles. The > consequence is that trying to open a bundle that uses a different object > hash than the current repository will fail: > > $ git bundle list-heads sha1.bundle > error: unrecognized header: ee4b540943284700a32591ad09f7e15bdeb2a10c HEAD (45)
That makes sense. And your test below, which covers a mismatch in the hash of the bundle vs the containing repo, would have failed even before the segfault issue. Nice.
> Fix the bug by defaulting to the SHA1 object hash. We already handle the > "@object-format=" header as expected, so we don't need to adapt this > part.
Yeah, this fix turned out to be delightfully simple as a result.
Both this patch and the first one look good to me. Thanks for jumping on this.
-Peff