Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-03-20 01:03:10 +0300
committerJunio C Hamano <gitster@pobox.com>2023-03-20 01:03:10 +0300
commit4a25b911cdb0cd79b6ab8b60ccbece77df03340d (patch)
tree16789d37c5339c7cfd14551334833c8eb5b21474 /builtin/receive-pack.c
parent67076b85b8f82c751fe634abb112139d6e32a5f1 (diff)
parent7c3c55026c25f038d790d21fb7242229a9a08fed (diff)
Merge branch 'zh/push-to-delete-onelevel-ref'
"git push" has been taught to allow deletion of refs with one-level names to help repairing a repository who acquired such a ref by mistake. In general, we don't encourage use of such a ref, and creation or update to such a ref is rejected as before. * zh/push-to-delete-onelevel-ref: push: allow delete single-level ref receive-pack: fix funny ref error messsage
Diffstat (limited to 'builtin/receive-pack.c')
-rw-r--r--builtin/receive-pack.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index fe68c79ee3..6a24ab4f45 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1460,8 +1460,10 @@ 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)) {
- rp_error("refusing to create funny ref '%s' remotely", name);
+ if (!starts_with(name, "refs/") ||
+ check_refname_format(name + 5, is_null_oid(new_oid) ?
+ REFNAME_ALLOW_ONELEVEL : 0)) {
+ rp_error("refusing to update funny ref '%s' remotely", name);
ret = "funny refname";
goto out;
}