Re: [PATCH v2 3/4] apply: remove the_repository global variable
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Oct 1, 2024, 12:32 UTC
- Message-ID
- <Zvvr1_9syRh1McVA@pks.im>
- In-Reply-To
- <ZvuBduVg9TJeULpl@ArchLinux>
On Tue, Oct 01, 2024 at 12:58:30PM +0800, shejialuo wrote:
Show 10 quoted lines
> On Mon, Sep 30, 2024 at 01:06:55PM -0700, Junio C Hamano wrote: > In my opinion, we should first think about how we handle the situation > where we run builtins outside of the repository. The most easiest way is > to pass the fallback object (aka "the_repository"). > > However, this seems a little strange. We are truly outside of the > repository but we really rely on the "struct repository *" to do many > operations. It's unrealistic to change so many interfaces which use the > "struct repository *". So, we should just use the fallback idea at > current.
I disagree with this statement. If code isn't prepare to not handle a `NULL` repository we shouldn't fall back to `the_repository`, but we should instead prepare the code to handle this case. This of course requires us to do a ton of refactorings, but that is the idea of this whole exercise to get rid of `the_repository`.
If a command cannot be converted to stop using `the_repository` right now we should skip it and revisit once all prerequisites have been adapted accordingly.
Patrick