git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Patrick SteinhardtNext: Junio C Hamano
Message 9 of 10 in “SIGSEGV Error Occurs When Attempting to Unbundle Without Initializing Git Repository.”
  1. ArcticLampyridAug 12, 2024
  2. Jeff KingAug 12, 2024
  3. Junio C HamanoAug 12, 2024
  4. brian m. carlsonAug 12, 2024
  5. 0/2 bundle: fix handling of object formatPatrick Steinhardt, Aug 13, 2024
  6. 1/2 builtin/bundle: have unbundle check for repo before opening its bundlePatrick Steinhardt, Aug 13, 2024
  7. Eric SunshineAug 13, 2024
  8. 2/2 bundle: default to SHA1 when reading bundle headersPatrick Steinhardt, Aug 13, 2024
  9. Jeff KingAug 13, 2024
  10. Junio C HamanoAug 13, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.