List for cgit developers and users
 help / color / mirror / Atom feed
From: cgit at cryptocrack.de (Lukas Fleischer)
Subject: [PATCH] ui-snapshot.c: Prepend "V" when guessing ref names
Date: Wed, 10 Apr 2013 13:04:03 +0200	[thread overview]
Message-ID: <1365591843-18339-1-git-send-email-cgit@cryptocrack.de> (raw)

In cgit_print_snapshot_links() we strip leading "v" and "V", while we
currently only prepend a lower case "v" when parsing a snapshot file
name. This results in broken snapshot links for tags that start with an
upper case "V". Avoid this by prepending a "V" as a fallback.

Signed-off-by: Lukas Fleischer <cgit at cryptocrack.de>
---
 ui-snapshot.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/ui-snapshot.c b/ui-snapshot.c
index 8e76977..42b7489 100644
--- a/ui-snapshot.c
+++ b/ui-snapshot.c
@@ -140,8 +140,8 @@ static int make_snapshot(const struct cgit_snapshot_format *format,
  * repo_basename(), we strip the basename and any following '-' and '_'
  * characters ("cgit-0.7.2" -> "0.7.2") and check the resulting name once
  * more. If this still isn't a valid commit object name, we check if pre-
- * pending a 'v' to the remaining snapshot name ("0.7.2" -> "v0.7.2") gives
- * us something valid.
+ * pending a 'v' or a 'V' to the remaining snapshot name ("0.7.2" ->
+ * "v0.7.2") gives us something valid.
  */
 static const char *get_ref_from_filename(const char *url, const char *filename,
 					 const struct cgit_snapshot_format *format)
@@ -173,6 +173,10 @@ static const char *get_ref_from_filename(const char *url, const char *filename,
 	if (get_sha1(snapshot.buf, sha1) == 0)
 		goto out;
 
+	strbuf_splice(&snapshot, 0, 1, "V", 1);
+	if (get_sha1(snapshot.buf, sha1) == 0)
+		goto out;
+
 	result = 0;
 	strbuf_release(&snapshot);
 
-- 
1.8.2.675.gda3bb24.dirty





             reply	other threads:[~2013-04-10 11:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-10 11:04 cgit [this message]
2013-04-10 12:34 ` Jason

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=1365591843-18339-1-git-send-email-cgit@cryptocrack.de \
    --to=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).