Re: [PATCH 2/7] grep: use submodule-ODB-as-alternate lazy-addition
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- Aug 13, 2021, 16:31 UTC
- Message-ID
- <20210813163111.3212129-1-jonathantanmy@google.com>
- In-Reply-To
- <YRRC528p06ByShE5@google.com>
> I had wondered whether we can entirely drop add_to_alternates_memory() > but I see on second reading that that's still used by > register_all_submodule_odb...(). I wonder if it can become static in > submodule.c to prevent users from dodging the envvar+BUG()?
You mean make add_to_alternates_memory() static? I'm not sure how we can do that - alternates is a concern that extends beyond submodules.
> Curious whether add_submodule_odb() can be reduced by calling > add_submodule_odb_by_path() internally.
That's a reasonable idea, but I don't think it works in this case - in particular, add_submodule_odb_by_path() dups its argument whereas add_submodule_odb() already has an allocated string that it is prepared to give up ownership of. Also, add_submodule_odb_by_path() is only one line, so it won't save us much.