All of lore.kernel.org
 help / color / mirror / Atom feed
From: "ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Junio C Hamano" <gitster@pobox.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>,
	"ZheNing Hu" <adlternative@gmail.com>
Subject: [PATCH 1/2] receive-pack: fix funny ref error messsage
Date: Tue, 17 Jan 2023 10:32:40 +0000	[thread overview]
Message-ID: <214a2b662e3f8d6826a916b88cd3162e2d110e0a.1673951562.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1465.git.1673951562.gitgitgadget@gmail.com>

From: ZheNing Hu <adlternative@gmail.com>

When the user deletes the remote one level branch through
"git push origin -d refs/foo", remote will return an error:
"refusing to create funny ref 'refs/foo' remotely", here we
are not creating "refs/foo" instead wants to delete it, so a
better error description here would be: "refusing to update
funny ref 'refs/foo' remotely".

Signed-off-by: ZheNing Hu <adlternative@gmail.com>
---
 builtin/receive-pack.c | 2 +-
 t/t5516-fetch-push.sh  | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index a90af303630..13ff9fae3ba 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1464,7 +1464,7 @@ static const char *update(struct command *cmd, struct shallow_info *si)
 
 	/* only refs/... are allowed */
 	if (!starts_with(name, "refs/") || check_refname_format(name + 5, 0)) {
-		rp_error("refusing to create funny ref '%s' remotely", name);
+		rp_error("refusing to update funny ref '%s' remotely", name);
 		ret = "funny refname";
 		goto out;
 	}
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 98a27a2948b..f37861efc40 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -401,6 +401,11 @@ test_expect_success 'push with ambiguity' '
 
 '
 
+test_expect_success 'push with onelevel ref' '
+	mk_test testrepo heads/main &&
+	test_must_fail git push testrepo HEAD:refs/onelevel
+'
+
 test_expect_success 'push with colon-less refspec (1)' '
 
 	mk_test testrepo heads/frotz tags/frotz &&
-- 
gitgitgadget


  reply	other threads:[~2023-01-17 10:36 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 ` ZheNing Hu via GitGitGadget [this message]
2023-01-17 10:32 ` [PATCH 2/2] " 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
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=214a2b662e3f8d6826a916b88cd3162e2d110e0a.1673951562.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=adlternative@gmail.com \
    --cc=avarab@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=derrickstolee@github.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.