Jonathan Tan <jonathantanmy@xxxxxxxxxx> writes: > I would write the commit message like this: > > submodule: fix latent check_has_commit() bug > > check_has_commit() will attempt to clear a non-initialized struct > repository if initialization fails. This bug is masked by its only > caller, submodule_has_commits(), first calling add_submodule_odb(). > The latter fails if the repo does not exist, making > submodule_has_commits() exit early and not invoke check_has_commit() > in a situation in which initialization would fail. > > Fix this bug, and because calling add_submodule_odb() is no longer > necessary as of 13a2f620b2 (submodule: pass repo to > check_has_commit(), 2021-10-08), remove that call too. > > This is the last caller of add_submodule_odb(), so remove that > function. (Adding submodule ODBs as alternates is still present in the > form of add_submodule_odb_by_path().) Looks more clearly explained. We still end up calling add_to_alternate_memory(), so I take the "let's have this early" back.