From: Junio C Hamano Date: Fri, 04 Mar 2022 02:17:51 GMT Subject: Re: [PATCH v4 10/10] submodule: fix latent check_has_commit() bug Message-ID: In-Reply-To: <20220304005757.70107-11-chooglen@google.com> Glen Choo writes: > When check_has_commit() is called on a missing submodule, initialization > of the struct repository fails, but it attempts to clear the struct > anyway (which is a fatal error). This bug is masked by its only caller, > submodule_has_commits(), first calling add_submodule_odb(). The latter > fails if the submodule does not exist, making submodule_has_commits() > exit early and not invoke check_has_commit(). > > 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. (Submodule ODBs are still added as alternates via > add_submodule_odb_by_path().) > > Signed-off-by: Glen Choo > --- > submodule.c | 35 ++--------------------------------- > submodule.h | 9 ++++----- > 2 files changed, 6 insertions(+), 38 deletions(-) Looks reasonable. Will queue. Thanks.