diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Offer tag snapshots only for a tagged commit
The tag page offered a download for a tag of a tree or a blob, which
only led to a "Not a commit" page. The refs listing already checks.
Diffstat (limited to '')
| -rw-r--r-- | source/ui-tag.c | 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 9 insertions, 5 deletions
diff --git a/source/ui-tag.c b/source/ui-tag.c index 559cb54..5fa8a17 100644 --- a/source/ui-tag.c +++ b/source/ui-tag.c @@ -57,8 +57,14 @@ static void print_object_row(struct object *obj) html("</td></tr>\n"); } -static void print_download_row(const char *revname) +/* + * A snapshot is cut from a commit, so a tag of anything else offers none, as in + * the refs listing. + */ +static void print_download_row(const char *revname, const struct object *obj) { + if (!ctx.repo->snapshots || obj->type != OBJ_COMMIT) + return; html("<tr><th scope='row'>download</th><td class='oid'>"); cgit_print_snapshot_links(ctx.repo, revname, "<br>"); html("</td></tr>\n"); @@ -111,8 +117,7 @@ static void print_annotated_tag(const char *revname, const struct object_id *oid if (info->tagger) print_tagger_row(info); print_object_row(tag->tagged); - if (ctx.repo->snapshots) - print_download_row(revname); + print_download_row(revname, tag->tagged); html("</table>\n"); print_message(info->msg); cgit_print_layout_end(); @@ -125,8 +130,7 @@ static void print_lightweight_tag(const char *revname, struct object *obj) html("<table class='commit-info'>\n"); print_name_row(revname, NULL); print_object_row(obj); - if (ctx.repo->snapshots) - print_download_row(revname); + print_download_row(revname, obj); html("</table>\n"); cgit_print_layout_end(); } |
