diff options
author | Lukas Fleischer | 2013-04-10 13:04:03 +0200 |
---|---|---|
committer | Jason A. Donenfeld | 2013-04-10 14:49:31 +0200 |
commit | 8c4c2c464b664228d4819af6ec1f8438af3c7c89 (patch) | |
tree | 446c5f5bee2ff0c6397f374dde1b7ec6e74d6924 /ui-snapshot.c | |
parent | 81bf4d32b377d3f2fdd7ab3ca651be99408f5c32 (diff) | |
download | cgit-8c4c2c464b664228d4819af6ec1f8438af3c7c89.tar.gz cgit-8c4c2c464b664228d4819af6ec1f8438af3c7c89.tar.bz2 cgit-8c4c2c464b664228d4819af6ec1f8438af3c7c89.zip |
ui-snapshot.c: Prepend "V" when guessing ref names
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@cryptocrack.de>
Diffstat (limited to 'ui-snapshot.c')
-rw-r--r-- | ui-snapshot.c | 8 |
1 files 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, | |||
140 | * repo_basename(), we strip the basename and any following '-' and '_' | 140 | * repo_basename(), we strip the basename and any following '-' and '_' |
141 | * characters ("cgit-0.7.2" -> "0.7.2") and check the resulting name once | 141 | * characters ("cgit-0.7.2" -> "0.7.2") and check the resulting name once |
142 | * more. If this still isn't a valid commit object name, we check if pre- | 142 | * more. If this still isn't a valid commit object name, we check if pre- |
143 | * pending a 'v' to the remaining snapshot name ("0.7.2" -> "v0.7.2") gives | 143 | * pending a 'v' or a 'V' to the remaining snapshot name ("0.7.2" -> |
144 | * us something valid. | 144 | * "v0.7.2") gives us something valid. |
145 | */ | 145 | */ |
146 | static const char *get_ref_from_filename(const char *url, const char *filename, | 146 | static const char *get_ref_from_filename(const char *url, const char *filename, |
147 | const struct cgit_snapshot_format *format) | 147 | const struct cgit_snapshot_format *format) |
@@ -173,6 +173,10 @@ static const char *get_ref_from_filename(const char *url, const char *filename, | |||
173 | if (get_sha1(snapshot.buf, sha1) == 0) | 173 | if (get_sha1(snapshot.buf, sha1) == 0) |
174 | goto out; | 174 | goto out; |
175 | 175 | ||
176 | strbuf_splice(&snapshot, 0, 1, "V", 1); | ||
177 | if (get_sha1(snapshot.buf, sha1) == 0) | ||
178 | goto out; | ||
179 | |||
176 | result = 0; | 180 | result = 0; |
177 | strbuf_release(&snapshot); | 181 | strbuf_release(&snapshot); |
178 | 182 | ||