-rw-r--r-- | ui-summary.c | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/ui-summary.c b/ui-summary.c index b4bc6d8..de8a180 100644 --- a/ui-summary.c +++ b/ui-summary.c | |||
@@ -38,49 +38,24 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1, | |||
38 | cgit_free_commitinfo(info); | 38 | cgit_free_commitinfo(info); |
39 | } else { | 39 | } else { |
40 | html("<tr><td>"); | 40 | html("<tr><td>"); |
41 | html_txt(buf); | 41 | html_txt(buf); |
42 | html("</td><td colspan='3'>"); | 42 | html("</td><td colspan='3'>"); |
43 | htmlf("*** bad ref %s ***", sha1_to_hex(sha1)); | 43 | htmlf("*** bad ref %s ***", sha1_to_hex(sha1)); |
44 | html("</td></tr>\n"); | 44 | html("</td></tr>\n"); |
45 | } | 45 | } |
46 | free(ref); | 46 | free(ref); |
47 | return 0; | 47 | return 0; |
48 | } | 48 | } |
49 | 49 | ||
50 | |||
51 | static void cgit_print_object_ref(struct object *obj) | ||
52 | { | ||
53 | char *page, *arg, *url; | ||
54 | |||
55 | if (obj->type == OBJ_COMMIT) { | ||
56 | cgit_commit_link(fmt("commit %s", sha1_to_hex(obj->sha1)), NULL, NULL, | ||
57 | cgit_query_head, sha1_to_hex(obj->sha1)); | ||
58 | return; | ||
59 | } else if (obj->type == OBJ_TREE) { | ||
60 | page = "tree"; | ||
61 | arg = "id"; | ||
62 | } else { | ||
63 | page = "view"; | ||
64 | arg = "id"; | ||
65 | } | ||
66 | |||
67 | url = cgit_pageurl(cgit_query_repo, page, | ||
68 | fmt("%s=%s", arg, sha1_to_hex(obj->sha1))); | ||
69 | html_link_open(url, NULL, NULL); | ||
70 | htmlf("%s %s", typename(obj->type), | ||
71 | sha1_to_hex(obj->sha1)); | ||
72 | html_link_close(); | ||
73 | } | ||
74 | |||
75 | static void print_tag_header() | 50 | static void print_tag_header() |
76 | { | 51 | { |
77 | html("<tr class='nohover'><th class='left'>Tag</th>" | 52 | html("<tr class='nohover'><th class='left'>Tag</th>" |
78 | "<th class='left'>Age</th>" | 53 | "<th class='left'>Age</th>" |
79 | "<th class='left'>Author</th>" | 54 | "<th class='left'>Author</th>" |
80 | "<th class='left'>Reference</th></tr>\n"); | 55 | "<th class='left'>Reference</th></tr>\n"); |
81 | header = 1; | 56 | header = 1; |
82 | } | 57 | } |
83 | 58 | ||
84 | static int cgit_print_tag_cb(const char *refname, const unsigned char *sha1, | 59 | static int cgit_print_tag_cb(const char *refname, const unsigned char *sha1, |
85 | int flags, void *cb_data) | 60 | int flags, void *cb_data) |
86 | { | 61 | { |
@@ -91,45 +66,45 @@ static int cgit_print_tag_cb(const char *refname, const unsigned char *sha1, | |||
91 | 66 | ||
92 | strncpy(buf, refname, sizeof(buf)); | 67 | strncpy(buf, refname, sizeof(buf)); |
93 | obj = parse_object(sha1); | 68 | obj = parse_object(sha1); |
94 | if (!obj) | 69 | if (!obj) |
95 | return 1; | 70 | return 1; |
96 | if (obj->type == OBJ_TAG) { | 71 | if (obj->type == OBJ_TAG) { |
97 | tag = lookup_tag(sha1); | 72 | tag = lookup_tag(sha1); |
98 | if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) | 73 | if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) |
99 | return 2; | 74 | return 2; |
100 | if (!header) | 75 | if (!header) |
101 | print_tag_header(); | 76 | print_tag_header(); |
102 | html("<tr><td>"); | 77 | html("<tr><td>"); |
103 | url = cgit_pageurl(cgit_query_repo, "view", | 78 | url = cgit_pageurl(cgit_query_repo, "tag", |
104 | fmt("id=%s", sha1_to_hex(sha1))); | 79 | fmt("id=%s", refname)); |
105 | html_link_open(url, NULL, NULL); | 80 | html_link_open(url, NULL, NULL); |
106 | html_txt(buf); | 81 | html_txt(buf); |
107 | html_link_close(); | 82 | html_link_close(); |
108 | html("</td><td>"); | 83 | html("</td><td>"); |
109 | if (info->tagger_date > 0) | 84 | if (info->tagger_date > 0) |
110 | cgit_print_age(info->tagger_date, -1, NULL); | 85 | cgit_print_age(info->tagger_date, -1, NULL); |
111 | html("</td><td>"); | 86 | html("</td><td>"); |
112 | if (info->tagger) | 87 | if (info->tagger) |
113 | html(info->tagger); | 88 | html(info->tagger); |
114 | html("</td><td>"); | 89 | html("</td><td>"); |
115 | cgit_print_object_ref(tag->tagged); | 90 | cgit_object_link(tag->tagged); |
116 | html("</td></tr>\n"); | 91 | html("</td></tr>\n"); |
117 | } else { | 92 | } else { |
118 | if (!header) | 93 | if (!header) |
119 | print_tag_header(); | 94 | print_tag_header(); |
120 | html("<tr><td>"); | 95 | html("<tr><td>"); |
121 | html_txt(buf); | 96 | html_txt(buf); |
122 | html("</td><td colspan='2'/><td>"); | 97 | html("</td><td colspan='2'/><td>"); |
123 | cgit_print_object_ref(obj); | 98 | cgit_object_link(obj); |
124 | html("</td></tr>\n"); | 99 | html("</td></tr>\n"); |
125 | } | 100 | } |
126 | return 0; | 101 | return 0; |
127 | } | 102 | } |
128 | 103 | ||
129 | static int cgit_print_archive_cb(const char *refname, const unsigned char *sha1, | 104 | static int cgit_print_archive_cb(const char *refname, const unsigned char *sha1, |
130 | int flags, void *cb_data) | 105 | int flags, void *cb_data) |
131 | { | 106 | { |
132 | struct tag *tag; | 107 | struct tag *tag; |
133 | struct taginfo *info; | 108 | struct taginfo *info; |
134 | struct object *obj; | 109 | struct object *obj; |
135 | char buf[256], *url; | 110 | char buf[256], *url; |