-rw-r--r-- | ui-summary.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/ui-summary.c b/ui-summary.c index de8a180..1e895a6 100644 --- a/ui-summary.c +++ b/ui-summary.c | |||
@@ -10,41 +10,35 @@ | |||
10 | 10 | ||
11 | static int header; | 11 | static int header; |
12 | 12 | ||
13 | static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1, | 13 | static void cgit_print_branch(struct refinfo *ref) |
14 | int flags, void *cb_data) | ||
15 | { | 14 | { |
16 | struct commit *commit; | 15 | struct commit *commit; |
17 | struct commitinfo *info; | 16 | struct commitinfo *info; |
18 | char buf[256]; | 17 | char *name = (char *)ref->refname; |
19 | char *ref; | ||
20 | 18 | ||
21 | ref = xstrdup(refname); | 19 | commit = lookup_commit(ref->object->sha1); |
22 | strncpy(buf, refname, sizeof(buf)); | ||
23 | commit = lookup_commit(sha1); | ||
24 | // object is not really parsed at this point, because of some fallout | 20 | // object is not really parsed at this point, because of some fallout |
25 | // from previous calls to git functions in cgit_print_log() | 21 | // from previous calls to git functions in cgit_print_log() |
26 | commit->object.parsed = 0; | 22 | commit->object.parsed = 0; |
27 | if (commit && !parse_commit(commit)){ | 23 | if (commit && !parse_commit(commit)){ |
28 | info = cgit_parse_commit(commit); | 24 | info = cgit_parse_commit(commit); |
29 | html("<tr><td>"); | 25 | html("<tr><td>"); |
30 | cgit_log_link(ref, NULL, NULL, ref, NULL, NULL, 0); | 26 | cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0); |
31 | html("</td><td>"); | 27 | html("</td><td>"); |
32 | cgit_print_age(commit->date, -1, NULL); | 28 | cgit_print_age(commit->date, -1, NULL); |
33 | html("</td><td>"); | 29 | html("</td><td>"); |
34 | html_txt(info->author); | 30 | html_txt(info->author); |
35 | html("</td><td>"); | 31 | html("</td><td>"); |
36 | cgit_commit_link(info->subject, NULL, NULL, ref, NULL); | 32 | cgit_commit_link(info->subject, NULL, NULL, name, NULL); |
37 | html("</td></tr>\n"); | 33 | html("</td></tr>\n"); |
38 | cgit_free_commitinfo(info); | 34 | cgit_free_commitinfo(info); |
39 | } else { | 35 | } else { |
40 | html("<tr><td>"); | 36 | html("<tr><td>"); |
41 | html_txt(buf); | 37 | html_txt(name); |
42 | html("</td><td colspan='3'>"); | 38 | html("</td><td colspan='3'>"); |
43 | htmlf("*** bad ref %s ***", sha1_to_hex(sha1)); | 39 | htmlf("*** bad ref %s ***", sha1_to_hex(ref->object->sha1)); |
44 | html("</td></tr>\n"); | 40 | html("</td></tr>\n"); |
45 | } | 41 | } |
46 | free(ref); | ||
47 | return 0; | ||
48 | } | 42 | } |
49 | 43 | ||
50 | static void print_tag_header() | 44 | static void print_tag_header() |
@@ -144,11 +138,19 @@ static int cgit_print_archive_cb(const char *refname, const unsigned char *sha1, | |||
144 | 138 | ||
145 | static void cgit_print_branches() | 139 | static void cgit_print_branches() |
146 | { | 140 | { |
141 | struct reflist list; | ||
142 | int i; | ||
143 | |||
147 | html("<tr class='nohover'><th class='left'>Branch</th>" | 144 | html("<tr class='nohover'><th class='left'>Branch</th>" |
148 | "<th class='left'>Idle</th>" | 145 | "<th class='left'>Idle</th>" |
149 | "<th class='left'>Author</th>" | 146 | "<th class='left'>Author</th>" |
150 | "<th class='left'>Head commit</th></tr>\n"); | 147 | "<th class='left'>Head commit</th></tr>\n"); |
151 | for_each_branch_ref(cgit_print_branch_cb, NULL); | 148 | |
149 | list.refs = NULL; | ||
150 | list.alloc = list.count = 0; | ||
151 | for_each_branch_ref(cgit_refs_cb, &list); | ||
152 | for(i=0; i<list.count; i++) | ||
153 | cgit_print_branch(list.refs[i]); | ||
152 | } | 154 | } |
153 | 155 | ||
154 | static void cgit_print_tags() | 156 | static void cgit_print_tags() |