git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: shejialuo <shejialuo@gmail.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Ronan Pigott <ronan@rjp.ie>,
	git@vger.kernel.org, Patrick Steinhardt <ps@pks.im>
Subject: Re: BUG: refs.c:1933: reference backend is unknown
Date: Sun, 22 Sep 2024 14:51:30 +0800	[thread overview]
Message-ID: <Zu--coU4qv6Z1SmD@ArchLinux> (raw)
In-Reply-To: <9bf5c254-4d87-4f6f-b278-d9df4d7897b5@web.de>

On Sat, Sep 21, 2024 at 11:22:04PM +0200, René Scharfe wrote:

[snip]

> 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

  reply	other threads:[~2024-09-22  6:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-20 17:37 BUG: refs.c:1933: reference backend is unknown Ronan Pigott
2024-09-21 16:09 ` shejialuo
2024-09-21 18:06   ` Ronan Pigott
2024-09-21 21:22     ` René Scharfe
2024-09-22  6:51       ` shejialuo [this message]
2024-09-22 14:41         ` shejialuo
2024-09-24 10:05 ` [PATCH 0/2] config: fix evaluating "onbranch" with nonexistent git dir Patrick Steinhardt
2024-09-24 10:05   ` [PATCH 1/2] t1305: exercise edge cases of "onbranch" includes Patrick Steinhardt
2024-09-24 16:05     ` Junio C Hamano
2024-09-24 10:05   ` [PATCH 2/2] config: fix evaluating "onbranch" with nonexistent git dir Patrick Steinhardt
2024-09-24 14:11     ` shejialuo
2024-09-24 16:17     ` Junio C Hamano
2024-09-24 14:20   ` [PATCH 0/2] " shejialuo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zu--coU4qv6Z1SmD@ArchLinux \
    --to=shejialuo@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    --cc=ps@pks.im \
    --cc=ronan@rjp.ie \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).