public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste•net>
To: Michael Schroeder <mls@suse•de>
Cc: git@vger•kernel.org, gitster@pobox•com
Subject: Re: [PATCH] submodule: truncate the oid when fetchig commits
Date: Thu, 14 Aug 2025 22:16:24 +0000	[thread overview]
Message-ID: <aJ5gOPQ9oologqj-@fruit.crustytoothpaste.net> (raw)
In-Reply-To: <aJ37eHEGMw6RgmZC@suse.de>

[-- Attachment #1: Type: text/plain, Size: 1007 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

  parent reply	other threads:[~2025-08-14 22:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-14 15:06 [PATCH] submodule: truncate the oid when fetchig commits Michael Schroeder
2025-08-14 15:42 ` Junio C Hamano
2025-08-18  9:15   ` [PATCH v2] " Michael Schroeder
2025-08-14 22:16 ` brian m. carlson [this message]
2025-08-18  9:30   ` [PATCH] " Michael Schroeder
2025-08-19  0:45     ` brian m. carlson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aJ5gOPQ9oologqj-@fruit.crustytoothpaste.net \
    --to=sandals@crustytoothpaste$(echo .)net \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=mls@suse$(echo .)de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox