From: "Ulrich Spörlein" <uqs@FreeBSD.org>
To: cgit@lists.zx2c4.com
Cc: "Ulrich Spörlein" <uqs@FreeBSD.org>
Subject: [PATCH] Handle tags outside of refs/tags gracefully.
Date: Mon, 28 Dec 2020 14:35:50 +0100 [thread overview]
Message-ID: <20201228133550.67945-1-uqs@FreeBSD.org> (raw)
Big conversions from Subversion to Git might keep track of several
"internal" tags under namespaces different from refs/tags. If a full
refs specification was given, don't prepend refs/tags again.
This fixes a "Bad tag reference" for the FreeBSD project URLs like so:
https://cgit.freebsd.org/src/tag/?h=refs/backups/projects/mips@202126
(fun fact: the log handler properly handles
log/?h=backups/projects/mips@202126 though it is an annotated tag under
refs/backups.
This fixes issue https://github.com/freebsd/git_conv/issues/24
---
ui-tag.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/ui-tag.c b/ui-tag.c
index 424bbcc..cc86b31 100644
--- a/ui-tag.c
+++ b/ui-tag.c
@@ -47,7 +47,11 @@ void cgit_print_tag(char *revname)
if (!revname)
revname = ctx.qry.head;
- strbuf_addf(&fullref, "refs/tags/%s", revname);
+ if (!strncmp(revname, "refs/", 5)) {
+ strbuf_addstr(&fullref, revname);
+ } else {
+ strbuf_addf(&fullref, "refs/tags/%s", revname);
+ }
if (get_oid(fullref.buf, &oid)) {
cgit_print_error_page(404, "Not found",
"Bad tag reference: %s", revname);
--
2.24.0
next reply other threads:[~2020-12-28 13:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-28 13:35 Ulrich Spörlein [this message]
2020-12-29 11:37 ` Jason A. Donenfeld
2020-12-29 18:22 ` Ulrich Spörlein
2020-12-29 20:04 ` Jason A. Donenfeld
2020-12-29 20:33 ` Gianni Ceccarelli
2021-01-05 11:53 ` Gianni Ceccarelli
2021-01-05 13:09 ` John Keeping
2021-01-05 13:40 ` Gianni Ceccarelli
[not found] ` <CAJ9axoSnfttirTwaVNhZPa73KSw+PCTq_5MVyvUfT7AcDxLXPg@mail.gmail.com>
2021-01-05 17:12 ` Gianni Ceccarelli
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=20201228133550.67945-1-uqs@FreeBSD.org \
--to=uqs@freebsd.org \
--cc=cgit@lists.zx2c4.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 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).