All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Derrick Stolee" <derrickstolee@github.com>,
	"Elijah Newren" <newren@gmail.com>,
	"Michael Haggerty" <mhagger@alum.mit.edu>,
	"Christian Couder" <christian.couder@gmail.com>,
	"Jeff King" <peff@peff.net>,
	"ZheNing Hu" <adlternative@gmail.com>
Subject: Re: [PATCH v2 2/2] [RFC] push: allow delete one level ref
Date: Mon, 06 Feb 2023 14:13:26 -0800	[thread overview]
Message-ID: <xmqqbkm64f3t.fsf@gitster.g> (raw)
In-Reply-To: <966cb49c388b652861c773ad7430875bf7896c16.1675529298.git.gitgitgadget@gmail.com> (ZheNing Hu via GitGitGadget's message of "Sat, 04 Feb 2023 16:48:17 +0000")

"ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com> writes:

> diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
> index 13ff9fae3ba..77088f5ba8d 100644
> --- a/builtin/receive-pack.c
> +++ b/builtin/receive-pack.c
> @@ -1463,7 +1463,9 @@ static const char *update(struct command *cmd, struct shallow_info *si)
>  		find_shared_symref(worktrees, "HEAD", name);
>  
>  	/* only refs/... are allowed */
> -	if (!starts_with(name, "refs/") || check_refname_format(name + 5, 0)) {
> +	if (!starts_with(name, "refs/") ||
> +	    check_refname_format(name + 5, is_null_oid(new_oid) ?
> +				 REFNAME_ALLOW_ONELEVEL : 0)) {

I am somehow smelling that this is about "refs/stash" and it may be
a good thing to allow removing a leftover refs/stash remotely.  I am
not sure why we need to treat it differently while still blocking
update/modification.

Is it that we are actively discouraging one-level refs like
refs/stash, so removing is fine but once removed we do not allow
creating or updating?  It somewhat smells a hard to explain rule to
the users, at least to me.

> diff --git a/connect.c b/connect.c
> index 63e59641c0d..7a396ad72e9 100644
> --- a/connect.c
> +++ b/connect.c
> @@ -30,7 +30,8 @@ static int check_ref(const char *name, unsigned int flags)
>  		return 0;
>  
>  	/* REF_NORMAL means that we don't want the magic fake tag refs */
> -	if ((flags & REF_NORMAL) && check_refname_format(name, 0))
> +	if ((flags & REF_NORMAL) && check_refname_format(name,
> +							 REFNAME_ALLOW_ONELEVEL))
>  		return 0;

This side of the change does make sense.

Thanks.

  reply	other threads:[~2023-02-06 22:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-17 10:32 [PATCH 0/2] [RFC] push: allow delete one level ref ZheNing Hu via GitGitGadget
2023-01-17 10:32 ` [PATCH 1/2] receive-pack: fix funny ref error messsage ZheNing Hu via GitGitGadget
2023-01-17 10:32 ` [PATCH 2/2] [RFC] push: allow delete one level ref ZheNing Hu via GitGitGadget
2023-01-17 13:14   ` Ævar Arnfjörð Bjarmason
2023-01-19 17:39     ` ZheNing Hu
2023-02-04 16:48 ` [PATCH v2 0/2] " ZheNing Hu via GitGitGadget
2023-02-04 16:48   ` [PATCH v2 1/2] receive-pack: fix funny ref error messsage ZheNing Hu via GitGitGadget
2023-02-04 16:48   ` [PATCH v2 2/2] [RFC] push: allow delete one level ref ZheNing Hu via GitGitGadget
2023-02-06 22:13     ` Junio C Hamano [this message]
2023-02-24  6:02       ` ZheNing Hu
2023-02-24 17:12         ` Junio C Hamano
2023-02-25 14:11           ` ZheNing Hu
2023-02-27  1:57   ` [PATCH v3 0/2] " ZheNing Hu via GitGitGadget
2023-02-27  1:57     ` [PATCH v3 1/2] receive-pack: fix funny ref error messsage ZheNing Hu via GitGitGadget
2023-02-27 16:07       ` Junio C Hamano
2023-03-01  9:31         ` ZheNing Hu
2023-02-27  1:57     ` [PATCH v3 2/2] [RFC] push: allow delete single-level ref ZheNing Hu via GitGitGadget
2023-03-01 10:20     ` [PATCH v4 0/2] [RFC] push: allow delete one level ref ZheNing Hu via GitGitGadget
2023-03-01 10:20       ` [PATCH v4 1/2] receive-pack: fix funny ref error messsage ZheNing Hu via GitGitGadget
2023-03-01 10:20       ` [PATCH v4 2/2] push: allow delete single-level ref ZheNing Hu via GitGitGadget

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=xmqqbkm64f3t.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=adlternative@gmail.com \
    --cc=avarab@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=derrickstolee@github.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=mhagger@alum.mit.edu \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    /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.