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 22:41:35 +0800	[thread overview]
Message-ID: <ZvAsnyZrVTO-j6XB@ArchLinux> (raw)
In-Reply-To: <Zu--coU4qv6Z1SmD@ArchLinux>

On Sun, Sep 22, 2024 at 02:51:34PM +0800, shejialuo wrote:

[snip]

> 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".
> 

I have just scanned the recent code here, because Patrick has already
replaced the "the_repository", there is no problem here when set up the
configuration in the TOT.

The code will first check whether the "data->repo" is NULL.

However, there is still a problem after setup:

#5  0x0000555555780442 in ref_store_init (repo=0x555555948b00 <the_repo>,
    format=<optimized out>, gitdir=<optimized out>, flags=15) at refs.c:1938
#6  ref_store_init (repo=0x555555948b00 <the_repo>, format=<optimized out>,
    gitdir=<optimized out>, flags=15) at refs.c:1928
#7  get_main_ref_store (r=0x555555948b00 <the_repo>) at refs.c:1958
#8  0x00005555556a332d in include_by_branch (data=0x7fffffffd400,
    cond=0x555555953d13 "main.path", cond_len=4) at config.c:308
#9  include_condition_is_true (kvi=0x7fffffffd320, inc=0x7fffffffd400,
    cond=0x555555953d13 "main.path", cond_len=4) at config.c:408
#10 git_config_include (var=var@entry=0x555555953d00 "includeif.onbranch:main.path",
    value=value@entry=0x55555595382f "notexist", ctx=ctx@entry=0x7fffffffd280,
    data=data@entry=0x7fffffffd400) at config.c:438
#11 0x000055555569d3a3 in config_parse_pair (key=<optimized out>,
    value=0x55555595382f "notexist", kvi=kvi@entry=0x7fffffffd320,
    fn=fn@entry=0x5555556a3060 <git_config_include>, data=data@entry=0x7fffffffd400)
    at config.c:616
#12 0x000055555569dafd in parse_config_env_list (
    env=0x555555953810 "includeIf.onbranch:main.path", kvi=0x7fffffffd320,
    fn=0x5555556a3060 <git_config_include>, data=0x7fffffffd400) at config.c:699
#13 git_config_from_parameters (fn=fn@entry=0x5555556a3060 <git_config_include>,
    data=data@entry=0x7fffffffd400) at config.c:772
#14 0x000055555569e383 in do_git_config_sequence (opts=0x7fffffffd550,
    repo=repo@entry=0x555555948b00 <the_repo>,
    fn=fn@entry=0x5555556a3060 <git_config_include>, data=data@entry=0x7fffffffd400)
    at config.c:2131
#15 0x000055555569ed49 in config_with_options (fn=0x5555556a3060 <git_config_include>,
    data=0x7fffffffd400, config_source=<optimized out>, repo=0x555555948b00 <the_repo>,
    opts=<optimized out>) at config.c:2174
#16 0x000055555569eec7 in repo_read_config (repo=0x555555948b00 <the_repo>) at config.c:2544
#17 git_config_check_init (repo=repo@entry=0x555555948b00 <the_repo>) at config.c:2564
#18 0x00005555556a0272 in repo_config (repo=0x555555948b00 <the_repo>,
    fn=fn@entry=0x5555558218a0 <git_tar_config>, data=data@entry=0x0) at config.c:2576
#19 0x0000555555822651 in git_config (fn=0x5555558218a0 <git_tar_config>, data=0x0)
    at /home/shejialuo/Projects/git/config.h:704
#20 init_tar_archiver () at archive-tar.c:544
#21 0x00005555556700c9 in init_archivers () at archive.c:46
#22 0x000055555557f8b8 in cmd_archive (argc=2, argv=0x7fffffffdcc8, prefix=0x0)
    at builtin/archive.c:98
#23 0x00005555555753c9 in run_builtin (p=0x555555916760 <commands+96>, argc=2,
    argv=0x7fffffffdcc8) at git.c:483
#24 handle_builtin (argc=2, argv=0x7fffffffdcc8) at git.c:739
#25 0x0000555555576335 in run_argv (argcp=argcp@entry=0x7ffff

It still uses the old "git_config", so we still have a problem when we
explicitly specify the "--git-dir". However, once Patrick replaces all
the "the_repository", this bug should never exist. So, I won't dive into
this.

Thanks,
Jialuo

  reply	other threads:[~2024-09-22 14:40 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
2024-09-22 14:41         ` shejialuo [this message]
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=ZvAsnyZrVTO-j6XB@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).