From: Junio C Hamano <gitster@pobox.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org, "Ronan Pigott" <ronan@rjp.ie>,
shejialuo <shejialuo@gmail.com>, "René Scharfe" <l.s.r@web.de>
Subject: Re: [PATCH 2/2] config: fix evaluating "onbranch" with nonexistent git dir
Date: Tue, 24 Sep 2024 09:17:45 -0700 [thread overview]
Message-ID: <xmqq7cb1vxee.fsf@gitster.g> (raw)
In-Reply-To: <535d0d07506e8248e47f90c1a7581679fc297b3d.1727171197.git.ps@pks.im> (Patrick Steinhardt's message of "Tue, 24 Sep 2024 12:05:46 +0200")
Patrick Steinhardt <ps@pks.im> writes:
> As the quoted comment mentions, we'd ideally refactor the code to not
> set up `gitdir` with an invalid value in the first place, but that may
> be a bigger undertaking. Instead, refactor the code to use the ref
> storage format as an indicator of whether or not the ref store has been
> set up to fix the bug.
>
> Reported-by: Ronan Pigott <ronan@rjp.ie>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> ...
> - const char *refname = (!data->repo || !data->repo->gitdir) ?
> - NULL : refs_resolve_ref_unsafe(get_main_ref_store(data->repo),
> - "HEAD", 0, NULL, &flags);
> - const char *shortname;
> + const char *refname, *shortname;
>
> - if (!refname || !(flags & REF_ISSYMREF) ||
> - !skip_prefix(refname, "refs/heads/", &shortname))
> + if (!data->repo || data->repo->ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
> + return 0;
OK. A very direct check to see what we really care about.
next prev parent reply other threads:[~2024-09-24 16:17 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
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 [this message]
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=xmqq7cb1vxee.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=l.s.r@web.de \
--cc=ps@pks.im \
--cc=ronan@rjp.ie \
--cc=shejialuo@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.