Subject: Re: [PATCH v2 12/12] hash: stop depending on `the_repository` in `null_oid()`

From: Junio C Hamano <[email-masked]>
Date: Fri, 07 Mar 2025 08:53:33 -0800

Patrick Steinhardt <[email-masked]> writes:

> So in theory, I don't really think there is anything that keeps us from
> mixing object formats, and I even think that this is a necessary feature
> to have once people start to migrate their repositories to SHA256. There
> are people out there who use submodules, and it may not be feasible for
> them to wait until all of their submodules have been converted to SHA256
> to migrate their own repositories.
> ...
> Anyway, that was a bit of a tangent to your initial question: which hash
> should we be passing in the first place? As it turns out, we should be
> passing the superproject's null OID indeed. The object ID we pass to
> `repo_submodule_init()` does not describe any object in the submodule
> itself, but rather indicates which tree-ish the submodule information
> should be parsed from in the superproject. As such, it refers to an
> object in the superproject itself and should thus use its object hash.

Good reasoning.

So the null-object suitable for the superproject is what we want
there after all.  We've been using the_hash_algo, which is the
algorithm used in the_repository, which in turn *IS* the
superproject in this code path, so we have been correct all the time
;-)