Re: [PATCH v2 12/12] hash: stop depending on `the_repository` in `null_oid()`
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 7, 2025, 16:53 UTC
- Message-ID
- <xmqqbjucg4tu.fsf@gitster.g>
- In-Reply-To
- <Z8q3nzhl3DHETZgf@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 14 quoted lines
> 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 ;-)