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

Re: [PATCH] submodule: truncate the oid when fetchig commits

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Aug 14, 2025, 22:16 UTC
Message-ID
<aJ5gOPQ9oologqj-@fruit.crustytoothpaste.net>
In-Reply-To
<aJ37eHEGMw6RgmZC@suse.de>
On 2025-08-14 at 15:06:32, Michael Schroeder wrote:
Show 5 quoted lines
> If a submodule uses a different hash algorithm than used in
> the main repository, the recorded submodule commit is padded
> with zeros. This is usually not a problem as the default is to
> do submodule clones non-shallow and the commit can be found
> in the local objects.

This should not even work at all. It may currently behave as you suggest when the main repository is SHA-256 and the submodule is SHA-1, but it will corrupt the data if the submodule is SHA-256 and the main repository is SHA-1, since then the data will be truncated.

The proper way for this to work is that the SHA-1 version of the repository stores submodules in their SHA-1 states and the SHA-256 version of the repository stores submodules in their SHA-256 states. Yes, this means that you have to convert submodules to the same algorithm, but that's required because trees are binary and not text.

-- 
brian m. carlson (they/them)
Toronto, Ontario, CA
Previous: Michael SchroederNext: Michael Schroeder
Message 4 of 6 in “submodule: truncate the oid when fetchig commits”
  1. submodule: truncate the oid when fetchig commitsMichael Schroeder, Aug 14, 2025
  2. Junio C HamanoAug 14, 2025
  3. Michael SchroederAug 18, 2025
  4. brian m. carlsonAug 14, 2025
  5. Michael SchroederAug 18, 2025
  6. brian m. carlsonAug 19, 2025

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.