aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui-refs.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/ui-refs.c b/ui-refs.c
index 0399e6b..7406478 100644
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -127,47 +127,45 @@ static void print_tag_downloads(const struct cgit_repo *repo, const char *ref)
127 if (free_ref) 127 if (free_ref)
128 free((char *)ref); 128 free((char *)ref);
129} 129}
130
130static int print_tag(struct refinfo *ref) 131static int print_tag(struct refinfo *ref)
131{ 132{
132 struct tag *tag; 133 struct tag *tag = NULL;
133 struct taginfo *info; 134 struct taginfo *info = NULL;
134 char *name = (char *)ref->refname; 135 char *name = (char *)ref->refname;
136 struct object *obj = ref->object;
135 137
136 if (ref->object->type == OBJ_TAG) { 138 if (obj->type == OBJ_TAG) {
137 tag = (struct tag *)ref->object; 139 tag = (struct tag *)obj;
140 obj = tag->tagged;
138 info = ref->tag; 141 info = ref->tag;
139 if (!tag || !info) 142 if (!tag || !info)
140 return 1; 143 return 1;
141 html("<tr><td>"); 144 }
142 cgit_tag_link(name, NULL, NULL, ctx.qry.head, name); 145
143 html("</td><td>"); 146 html("<tr><td>");
144 if (ctx.repo->snapshots && (tag->tagged->type == OBJ_COMMIT)) 147 cgit_tag_link(name, NULL, NULL, ctx.qry.head, name);
145 print_tag_downloads(ctx.repo, name); 148 html("</td><td>");
146 else 149 if (ctx.repo->snapshots && (obj->type == OBJ_COMMIT))
147 cgit_object_link(tag->tagged); 150 print_tag_downloads(ctx.repo, name);
148 html("</td><td>"); 151 else
152 cgit_object_link(obj);
153 html("</td><td>");
154 if (info) {
149 if (info->tagger) 155 if (info->tagger)
150 html(info->tagger); 156 html(info->tagger);
151 html("</td><td colspan='2'>"); 157 } else if (ref->object->type == OBJ_COMMIT) {
158 html(ref->commit->author);
159 }
160 html("</td><td colspan='2'>");
161 if (info) {
152 if (info->tagger_date > 0) 162 if (info->tagger_date > 0)
153 cgit_print_age(info->tagger_date, -1, NULL); 163 cgit_print_age(info->tagger_date, -1, NULL);
154 html("</td></tr>\n"); 164 } else if (ref->object->type == OBJ_COMMIT) {
155 } else { 165 cgit_print_age(ref->commit->commit->date, -1, NULL);
156 html("<tr><td>");
157 cgit_tag_link(name, NULL, NULL, ctx.qry.head, name);
158 html("</td><td>");
159 if (ctx.repo->snapshots && (ref->object->type == OBJ_COMMIT))
160 print_tag_downloads(ctx.repo, name);
161 else
162 cgit_object_link(ref->object);
163 html("</td><td>");
164 if (ref->object->type == OBJ_COMMIT)
165 html(ref->commit->author);
166 html("</td><td colspan='2'>");
167 if (ref->object->type == OBJ_COMMIT)
168 cgit_print_age(ref->commit->commit->date, -1, NULL);
169 html("</td></tr>\n");
170 } 166 }
167 html("</td></tr>\n");
168
171 return 0; 169 return 0;
172} 170}
173 171