mirror of
https://git.zx2c4.com/cgit
synced 2024-11-22 16:38:42 +00:00
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>
This commit is contained in:
parent
81bf4d32b3
commit
8c4c2c464b
@ -140,8 +140,8 @@ static int make_snapshot(const struct cgit_snapshot_format *format,
|
|||||||
* repo_basename(), we strip the basename and any following '-' and '_'
|
* repo_basename(), we strip the basename and any following '-' and '_'
|
||||||
* characters ("cgit-0.7.2" -> "0.7.2") and check the resulting name once
|
* 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-
|
* 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
|
* pending a 'v' or a 'V' to the remaining snapshot name ("0.7.2" ->
|
||||||
* us something valid.
|
* "v0.7.2") gives us something valid.
|
||||||
*/
|
*/
|
||||||
static const char *get_ref_from_filename(const char *url, const char *filename,
|
static const char *get_ref_from_filename(const char *url, const char *filename,
|
||||||
const struct cgit_snapshot_format *format)
|
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)
|
if (get_sha1(snapshot.buf, sha1) == 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
strbuf_splice(&snapshot, 0, 1, "V", 1);
|
||||||
|
if (get_sha1(snapshot.buf, sha1) == 0)
|
||||||
|
goto out;
|
||||||
|
|
||||||
result = 0;
|
result = 0;
|
||||||
strbuf_release(&snapshot);
|
strbuf_release(&snapshot);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user