Re: [PATCH v2 1/5] submodule-config.h: remove unused SUBMODULE_INIT macro
- From
Jeff King <peff@peff.net>
- Date
- Sep 27, 2021, 23:34 UTC
- Message-ID
- <YVJU89iekC0zZSkF@coredump.intra.peff.net>
- In-Reply-To
- <patch-v2-1.5-7a7a0141515-20210927T124407Z-avarab@gmail.com>
On Mon, Sep 27, 2021 at 02:54:24PM +0200, Ævar Arnfjörð Bjarmason wrote:
Show 20 quoted lines
> This macro was added and used in c68f8375760 (implement fetching of
> moved submodules, 2017-10-16) but its last user went away in
> be76c212823 (fetch: ensure submodule objects fetched, 2018-12-06).
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
> submodule-config.h | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/submodule-config.h b/submodule-config.h
> index c11e22cf509..65875b94ea5 100644
> --- a/submodule-config.h
> +++ b/submodule-config.h
> @@ -45,10 +45,6 @@ struct submodule {
> struct object_id gitmodules_oid;
> int recommend_shallow;
> };
> -
> -#define SUBMODULE_INIT { NULL, NULL, NULL, RECURSE_SUBMODULES_NONE, \
> - NULL, NULL, SUBMODULE_UPDATE_STRATEGY_INIT, { { 0 } }, -1 };I was a bit surprised by this one, just because we generally prefer the builtin initializers to init functions. And even if we are only using the latter, I like the move to implementing it in terms of the former.
But this struct is extra funny, as now it will have neither. It comes only from submodule_from_name() or submodule_from_path(), which in turn are building up from config and the initialization in lookup_or_create_by_name(). And keeping those two in sync is potentially error-prone.
So this whole "make a submodule struct on the stack" thing is pretty odd in the first place, and I'm happy to see this initializer going away.
-Peff