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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2025-08-14 at 15:06:32, Michael Schroeder wrote:
> 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

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux