From: Phillip Wood <phillip.wood123@gmail.com>
To: Patrick Steinhardt <ps@pks.im>, git@vger.kernel.org
Cc: hanwenn@gmail.com
Subject: Re: [PATCH 3/4] refs: complete list of special refs
Date: Thu, 30 Nov 2023 15:42:06 +0000 [thread overview]
Message-ID: <15f67e21-c05f-4a72-9557-2a09a1311f25@gmail.com> (raw)
In-Reply-To: <0e38103114a206bedbbbd7ea97cb77fa05fd3c29.1701243201.git.ps@pks.im>
Hi Patrick
Thanks for working on this. I've left a couple of thought below.
On 29/11/2023 08:14, Patrick Steinhardt wrote:
> +static int is_special_ref(const char *refname)
> +{
> + /*
> + * Special references get written and read directly via the filesystem
> + * by the subsystems that create them. Thus, they must not go through
> + * the reference backend but must instead be read directly. It is
> + * arguable whether this behaviour is sensible, or whether it's simply
> + * a leaky abstraction enabled by us only having a single reference
> + * backend implementation. But at least for a subset of references it
> + * indeed does make sense to treat them specially:
> + *
> + * - FETCH_HEAD may contain multiple object IDs, and each one of them
> + * carries additional metadata like where it came from.
> + *
> + * - MERGE_HEAD may contain multiple object IDs when merging multiple
> + * heads.
> + *
> + * - "rebase-apply/" and "rebase-merge/" contain all of the state for
> + * rebases, where keeping it closely together feels sensible.
I'd really like to get away from treating these files as refs. I think
their use as refs is purely historic and predates the reflog and
possibly ORIG_HEAD. These days I'm not sure there is a good reason to be
running
git rev-parse rebase-merge/orig-head
One reason for not wanting to treat them as refs is that we do not
handle multi-level refs that do not begin with "refs/" consistently.
git update-ref foo/bar HEAD
succeeds and creates .git/foo/bar but
git update-ref -d foo/bar
fails with
error: refusing to update ref with bad name 'foo/bar'
To me it would make sense to refuse to create 'foo/bar' but allow an
existing ref named 'foo/bar' to be deleted but the current behavior is
the opposite of that.
I'd be quite happy to see us refuse to treat anything that fails
if (starts_with(refname, "refs/") || refname_is_safe(refname))
as a ref but I don't know how much pain that would cause.
> + const char * const special_refs[] = {
> + "AUTO_MERGE",
Is there any reason to treat this specially in the long term? It points
to a tree rather than a commit but unlike MERGE_HEAD and FETCH_HEAD it
is effectively a "normal" ref.
> + "BISECT_EXPECTED_REV",
> + "FETCH_HEAD",
> + "MERGE_AUTOSTASH",
Should we be treating this as a ref? I thought it was written as an
implementation detail of the autostash implementation rather than to
provide a ref for users and scripts.
Best Wishes
Phillip
next prev parent reply other threads:[~2023-11-30 15:42 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-29 8:14 [PATCH 0/4] refs: improve handling of special refs Patrick Steinhardt
2023-11-29 8:14 ` [PATCH 1/4] wt-status: read HEAD and ORIG_HEAD via the refdb Patrick Steinhardt
2023-11-29 21:45 ` Taylor Blau
2023-11-30 7:42 ` Patrick Steinhardt
2023-11-30 17:36 ` Taylor Blau
2023-11-29 8:14 ` [PATCH 2/4] refs: propagate errno when reading special refs fails Patrick Steinhardt
2023-11-29 21:51 ` Taylor Blau
2023-11-30 7:43 ` Patrick Steinhardt
2023-11-29 8:14 ` [PATCH 3/4] refs: complete list of special refs Patrick Steinhardt
2023-11-29 21:59 ` Taylor Blau
2023-11-30 7:44 ` Patrick Steinhardt
2023-11-30 15:42 ` Phillip Wood [this message]
2023-12-01 6:43 ` Patrick Steinhardt
2023-12-04 14:18 ` Phillip Wood
2023-11-29 8:14 ` [PATCH 4/4] bisect: consistently write BISECT_EXPECTED_REV via the refdb Patrick Steinhardt
2023-11-29 22:13 ` Taylor Blau
2023-11-29 22:14 ` [PATCH 0/4] refs: improve handling of special refs Taylor Blau
2023-11-30 7:46 ` Patrick Steinhardt
2023-11-30 17:35 ` Taylor Blau
2023-12-12 7:18 ` [PATCH v2 " Patrick Steinhardt
2023-12-12 7:18 ` [PATCH v2 1/4] wt-status: read HEAD and ORIG_HEAD via the refdb Patrick Steinhardt
2023-12-12 20:24 ` Junio C Hamano
2023-12-12 23:32 ` Ramsay Jones
2023-12-13 0:36 ` Junio C Hamano
2023-12-13 7:38 ` Patrick Steinhardt
2023-12-13 15:15 ` Junio C Hamano
2023-12-14 9:04 ` Patrick Steinhardt
2023-12-14 16:41 ` Junio C Hamano
2023-12-14 13:21 ` Patrick Steinhardt
2023-12-12 7:18 ` [PATCH v2 2/4] refs: propagate errno when reading special refs fails Patrick Steinhardt
2023-12-12 20:28 ` Junio C Hamano
2023-12-13 7:28 ` Patrick Steinhardt
2023-12-12 7:18 ` [PATCH v2 3/4] refs: complete list of special refs Patrick Steinhardt
2023-12-12 7:19 ` [PATCH v2 4/4] bisect: consistently write BISECT_EXPECTED_REV via the refdb Patrick Steinhardt
2023-12-14 13:36 ` [PATCH v3 0/4] refs: improve handling of special refs Patrick Steinhardt
2023-12-14 13:36 ` [PATCH v3 1/4] wt-status: read HEAD and ORIG_HEAD via the refdb Patrick Steinhardt
2023-12-14 13:37 ` [PATCH v3 2/4] refs: propagate errno when reading special refs fails Patrick Steinhardt
2023-12-14 13:37 ` [PATCH v3 3/4] refs: complete list of special refs Patrick Steinhardt
2023-12-14 13:37 ` [PATCH v3 4/4] bisect: consistently write BISECT_EXPECTED_REV via the refdb Patrick Steinhardt
2023-12-20 19:28 ` [PATCH v3 0/4] refs: improve handling of special refs Junio C Hamano
2023-12-21 10:08 ` Patrick Steinhardt
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=15f67e21-c05f-4a72-9557-2a09a1311f25@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=git@vger.kernel.org \
--cc=hanwenn@gmail.com \
--cc=phillip.wood@dunelm.org.uk \
--cc=ps@pks.im \
/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).