|
diff --git a/ui-refs.c b/ui-refs.c index 32e0429..d61ee7c 100644 --- a/ ui-refs.c+++ b/ ui-refs.c |
|
@@ -49,78 +49,110 @@ static int cmp_tag_age(const void *a, const void *b) |
49 | |
49 | |
50 | return cmp_age(r1->tag->tagger_date, r2->tag->tagger_date); |
50 | return cmp_age(r1->tag->tagger_date, r2->tag->tagger_date); |
51 | } |
51 | } |
52 | |
52 | |
53 | static int print_branch(struct refinfo *ref) |
53 | static int print_branch(struct refinfo *ref) |
54 | { |
54 | { |
55 | struct commitinfo *info = ref->commit; |
55 | struct commitinfo *info = ref->commit; |
56 | char *name = (char *)ref->refname; |
56 | char *name = (char *)ref->refname; |
57 | |
57 | |
58 | if (!info) |
58 | if (!info) |
59 | return 1; |
59 | return 1; |
60 | html("<tr><td>"); |
60 | html("<tr><td>"); |
61 | cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL); |
61 | cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL, |
| |
62 | ctx.qry.showmsg); |
62 | html("</td><td>"); |
63 | html("</td><td>"); |
63 | |
64 | |
64 | if (ref->object->type == OBJ_COMMIT) { |
65 | if (ref->object->type == OBJ_COMMIT) { |
65 | cgit_commit_link(info->subject, NULL, NULL, name, NULL); |
66 | cgit_commit_link(info->subject, NULL, NULL, name, NULL); |
66 | html("</td><td>"); |
67 | html("</td><td>"); |
67 | html_txt(info->author); |
68 | html_txt(info->author); |
68 | html("</td><td colspan='2'>"); |
69 | html("</td><td colspan='2'>"); |
69 | cgit_print_age(info->commit->date, -1, NULL); |
70 | cgit_print_age(info->commit->date, -1, NULL); |
70 | } else { |
71 | } else { |
71 | html("</td><td></td><td>"); |
72 | html("</td><td></td><td>"); |
72 | cgit_object_link(ref->object); |
73 | cgit_object_link(ref->object); |
73 | } |
74 | } |
74 | html("</td></tr>\n"); |
75 | html("</td></tr>\n"); |
75 | return 0; |
76 | return 0; |
76 | } |
77 | } |
77 | |
78 | |
78 | static void print_tag_header() |
79 | static void print_tag_header() |
79 | { |
80 | { |
80 | html("<tr class='nohover'><th class='left'>Tag</th>" |
81 | html("<tr class='nohover'><th class='left'>Tag</th>" |
81 | "<th class='left'>Reference</th>" |
82 | "<th class='left'>Download</th>" |
82 | "<th class='left'>Author</th>" |
83 | "<th class='left'>Author</th>" |
83 | "<th class='left' colspan='2'>Age</th></tr>\n"); |
84 | "<th class='left' colspan='2'>Age</th></tr>\n"); |
84 | header = 1; |
85 | header = 1; |
85 | } |
86 | } |
86 | |
87 | |
| |
88 | static void print_tag_downloads(const struct cgit_repo *repo, const char *ref) |
| |
89 | { |
| |
90 | const struct cgit_snapshot_format* f; |
| |
91 | char *filename; |
| |
92 | const char *basename; |
| |
93 | |
| |
94 | if (!ref || strlen(ref) < 2) |
| |
95 | return; |
| |
96 | |
| |
97 | basename = cgit_repobasename(repo->url); |
| |
98 | if (prefixcmp(ref, basename) != 0) { |
| |
99 | if ((ref[0] == 'v' || ref[0] == 'V') && isdigit(ref[1])) |
| |
100 | ref++; |
| |
101 | if (isdigit(ref[0])) |
| |
102 | ref = xstrdup(fmt("%s-%s", basename, ref)); |
| |
103 | } |
| |
104 | |
| |
105 | for (f = cgit_snapshot_formats; f->suffix; f++) { |
| |
106 | if (!(repo->snapshots & f->bit)) |
| |
107 | continue; |
| |
108 | filename = fmt("%s%s", ref, f->suffix); |
| |
109 | cgit_snapshot_link(filename, NULL, NULL, NULL, NULL, filename); |
| |
110 | html(" "); |
| |
111 | } |
| |
112 | } |
87 | static int print_tag(struct refinfo *ref) |
113 | static int print_tag(struct refinfo *ref) |
88 | { |
114 | { |
89 | struct tag *tag; |
115 | struct tag *tag; |
90 | struct taginfo *info; |
116 | struct taginfo *info; |
91 | char *name = (char *)ref->refname; |
117 | char *name = (char *)ref->refname; |
92 | |
118 | |
93 | if (ref->object->type == OBJ_TAG) { |
119 | if (ref->object->type == OBJ_TAG) { |
94 | tag = (struct tag *)ref->object; |
120 | tag = (struct tag *)ref->object; |
95 | info = ref->tag; |
121 | info = ref->tag; |
96 | if (!tag || !info) |
122 | if (!tag || !info) |
97 | return 1; |
123 | return 1; |
98 | html("<tr><td>"); |
124 | html("<tr><td>"); |
99 | cgit_tag_link(name, NULL, NULL, ctx.qry.head, name); |
125 | cgit_tag_link(name, NULL, NULL, ctx.qry.head, name); |
100 | html("</td><td>"); |
126 | html("</td><td>"); |
| |
127 | if (ctx.repo->snapshots && (tag->tagged->type == OBJ_COMMIT)) |
| |
128 | print_tag_downloads(ctx.repo, name); |
| |
129 | else |
101 | cgit_object_link(tag->tagged); |
130 | cgit_object_link(tag->tagged); |
102 | html("</td><td>"); |
131 | html("</td><td>"); |
103 | if (info->tagger) |
132 | if (info->tagger) |
104 | html(info->tagger); |
133 | html(info->tagger); |
105 | html("</td><td colspan='2'>"); |
134 | html("</td><td colspan='2'>"); |
106 | if (info->tagger_date > 0) |
135 | if (info->tagger_date > 0) |
107 | cgit_print_age(info->tagger_date, -1, NULL); |
136 | cgit_print_age(info->tagger_date, -1, NULL); |
108 | html("</td></tr>\n"); |
137 | html("</td></tr>\n"); |
109 | } else { |
138 | } else { |
110 | if (!header) |
139 | if (!header) |
111 | print_tag_header(); |
140 | print_tag_header(); |
112 | html("<tr><td>"); |
141 | html("<tr><td>"); |
113 | html_txt(name); |
142 | html_txt(name); |
114 | html("</td><td>"); |
143 | html("</td><td>"); |
| |
144 | if (ctx.repo->snapshots && (tag->tagged->type == OBJ_COMMIT)) |
| |
145 | print_tag_downloads(ctx.repo, name); |
| |
146 | else |
115 | cgit_object_link(ref->object); |
147 | cgit_object_link(ref->object); |
116 | html("</td></tr>\n"); |
148 | html("</td></tr>\n"); |
117 | } |
149 | } |
118 | return 0; |
150 | return 0; |
119 | } |
151 | } |
120 | |
152 | |
121 | static void print_refs_link(char *path) |
153 | static void print_refs_link(char *path) |
122 | { |
154 | { |
123 | html("<tr class='nohover'><td colspan='4'>"); |
155 | html("<tr class='nohover'><td colspan='4'>"); |
124 | cgit_refs_link("[...]", NULL, NULL, ctx.qry.head, NULL, path); |
156 | cgit_refs_link("[...]", NULL, NULL, ctx.qry.head, NULL, path); |
125 | html("</td></tr>"); |
157 | html("</td></tr>"); |
126 | } |
158 | } |
|