From: Junio C Hamano Date: Fri, 11 Feb 2022 17:19:16 GMT Subject: Re: [PATCH 8/8] submodule: fix bug and remove add_submodule_odb() Message-ID: In-Reply-To: <20220210230422.690368-1-jonathantanmy@google.com> Jonathan Tan 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.