Re: BUG: refs.c:1933: reference backend is unknown
- From
shejialuo <shejialuo@gmail.com>
- Date
- Sep 22, 2024, 06:51 UTC
- Message-ID
- <Zu--coU4qv6Z1SmD@ArchLinux>
- In-Reply-To
- <9bf5c254-4d87-4f6f-b278-d9df4d7897b5@web.de>
On Sat, Sep 21, 2024 at 11:22:04PM +0200, René Scharfe wrote:
[snip]
Show 7 quoted lines
> I wonder if the BUG at refs.c:1933 should just be turned into a die(). > Or should ref_store_init() return NULL (or some other value indicating > an error) and all callers need to be changed to deal with that? > > Simply checking whether --git-dir points to an actual repo earlier is > tempting, but would leave the case of it disappearing after the check > unhandled.
From my perspective, it is not suitable to change the "refs.c". I guess the reason why Patrick uses the "BUG()" is that it's an internal implementation and we should tell the developer something is wrong.
In this case, because we use "include.onbranch" configuration, the "config.c::include_by_branch" will use "refsc::get_main_ref_store" to get the refname.
However, the repo does not exist, so we cannot find any ref backend. The main problem is that we never check whether "the_repository->gitdir" is a git directory in "config.c::include_by_branch". So, we do not need to check the value of the option "--git-dir".
Thanks, Jialuo