mirror of
https://git.zx2c4.com/cgit
synced 2024-11-29 20:06:21 +00:00
Use reflist to print tag info
This updates ui-summary.c to use a reflist instead of for_each_tag_ref(), as a step towards more flexible tag handling (filtering/sorting). Signed-off-by: Lars Hjemli <hjemli@gmail.com>
This commit is contained in:
parent
0c1ebce204
commit
502d71072a
36
ui-summary.c
36
ui-summary.c
@ -50,29 +50,21 @@ static void print_tag_header()
|
|||||||
header = 1;
|
header = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cgit_print_tag_cb(const char *refname, const unsigned char *sha1,
|
static int print_tag(struct refinfo *ref)
|
||||||
int flags, void *cb_data)
|
|
||||||
{
|
{
|
||||||
struct tag *tag;
|
struct tag *tag;
|
||||||
struct taginfo *info;
|
struct taginfo *info;
|
||||||
struct object *obj;
|
char *url, *name = (char *)ref->refname;
|
||||||
char buf[256], *url;
|
|
||||||
|
|
||||||
strncpy(buf, refname, sizeof(buf));
|
if (ref->object->type == OBJ_TAG) {
|
||||||
obj = parse_object(sha1);
|
tag = lookup_tag(ref->object->sha1);
|
||||||
if (!obj)
|
|
||||||
return 1;
|
|
||||||
if (obj->type == OBJ_TAG) {
|
|
||||||
tag = lookup_tag(sha1);
|
|
||||||
if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag)))
|
if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag)))
|
||||||
return 2;
|
return 2;
|
||||||
if (!header)
|
|
||||||
print_tag_header();
|
|
||||||
html("<tr><td>");
|
html("<tr><td>");
|
||||||
url = cgit_pageurl(cgit_query_repo, "tag",
|
url = cgit_pageurl(cgit_query_repo, "tag",
|
||||||
fmt("id=%s", refname));
|
fmt("id=%s", name));
|
||||||
html_link_open(url, NULL, NULL);
|
html_link_open(url, NULL, NULL);
|
||||||
html_txt(buf);
|
html_txt(name);
|
||||||
html_link_close();
|
html_link_close();
|
||||||
html("</td><td>");
|
html("</td><td>");
|
||||||
if (info->tagger_date > 0)
|
if (info->tagger_date > 0)
|
||||||
@ -87,9 +79,9 @@ static int cgit_print_tag_cb(const char *refname, const unsigned char *sha1,
|
|||||||
if (!header)
|
if (!header)
|
||||||
print_tag_header();
|
print_tag_header();
|
||||||
html("<tr><td>");
|
html("<tr><td>");
|
||||||
html_txt(buf);
|
html_txt(name);
|
||||||
html("</td><td colspan='2'/><td>");
|
html("</td><td colspan='2'/><td>");
|
||||||
cgit_object_link(obj);
|
cgit_object_link(ref->object);
|
||||||
html("</td></tr>\n");
|
html("</td></tr>\n");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -155,8 +147,18 @@ static void cgit_print_branches()
|
|||||||
|
|
||||||
static void cgit_print_tags()
|
static void cgit_print_tags()
|
||||||
{
|
{
|
||||||
|
struct reflist list;
|
||||||
|
int i;
|
||||||
|
|
||||||
header = 0;
|
header = 0;
|
||||||
for_each_tag_ref(cgit_print_tag_cb, NULL);
|
list.refs = NULL;
|
||||||
|
list.alloc = list.count = 0;
|
||||||
|
for_each_tag_ref(cgit_refs_cb, &list);
|
||||||
|
if (list.count == 0)
|
||||||
|
return;
|
||||||
|
print_tag_header();
|
||||||
|
for(i=0; i<list.count; i++)
|
||||||
|
print_tag(list.refs[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cgit_print_archives()
|
static void cgit_print_archives()
|
||||||
|
Loading…
Reference in New Issue
Block a user