diff options
Diffstat (limited to 'ui-log.c')
-rw-r--r-- | ui-log.c | 38 |
1 files changed, 37 insertions, 1 deletions
@@ -31,6 +31,38 @@ void inspect_files(struct diff_filepair *pair) | |||
31 | cgit_diff_files(pair->one->sha1, pair->two->sha1, count_lines); | 31 | cgit_diff_files(pair->one->sha1, pair->two->sha1, count_lines); |
32 | } | 32 | } |
33 | 33 | ||
34 | void show_commit_decorations(struct commit *commit) | ||
35 | { | ||
36 | struct name_decoration *deco; | ||
37 | static char buf[1024]; | ||
38 | |||
39 | buf[sizeof(buf) - 1] = 0; | ||
40 | deco = lookup_decoration(&name_decoration, &commit->object); | ||
41 | while (deco) { | ||
42 | if (!prefixcmp(deco->name, "refs/heads/")) { | ||
43 | strncpy(buf, deco->name + 11, sizeof(buf) - 1); | ||
44 | cgit_log_link(buf, NULL, "branch-deco", buf, NULL, NULL, | ||
45 | 0, NULL, NULL, ctx.qry.showmsg); | ||
46 | } | ||
47 | else if (!prefixcmp(deco->name, "tag: refs/tags/")) { | ||
48 | strncpy(buf, deco->name + 15, sizeof(buf) - 1); | ||
49 | cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf); | ||
50 | } | ||
51 | else if (!prefixcmp(deco->name, "refs/remotes/")) { | ||
52 | strncpy(buf, deco->name + 13, sizeof(buf) - 1); | ||
53 | cgit_log_link(buf, NULL, "remote-deco", NULL, | ||
54 | sha1_to_hex(commit->object.sha1), NULL, | ||
55 | 0, NULL, NULL, ctx.qry.showmsg); | ||
56 | } | ||
57 | else { | ||
58 | strncpy(buf, deco->name, sizeof(buf) - 1); | ||
59 | cgit_commit_link(buf, NULL, "deco", ctx.qry.head, | ||
60 | sha1_to_hex(commit->object.sha1)); | ||
61 | } | ||
62 | deco = deco->next; | ||
63 | } | ||
64 | } | ||
65 | |||
34 | void print_commit(struct commit *commit) | 66 | void print_commit(struct commit *commit) |
35 | { | 67 | { |
36 | struct commitinfo *info; | 68 | struct commitinfo *info; |
@@ -49,6 +81,7 @@ void print_commit(struct commit *commit) | |||
49 | ctx.qry.showmsg ? " class='logsubject'" : ""); | 81 | ctx.qry.showmsg ? " class='logsubject'" : ""); |
50 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, | 82 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, |
51 | sha1_to_hex(commit->object.sha1)); | 83 | sha1_to_hex(commit->object.sha1)); |
84 | show_commit_decorations(commit); | ||
52 | html("</td><td>"); | 85 | html("</td><td>"); |
53 | html_txt(info->author); | 86 | html_txt(info->author); |
54 | if (ctx.repo->enable_log_filecount) { | 87 | if (ctx.repo->enable_log_filecount) { |
@@ -119,6 +152,8 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
119 | rev.verbose_header = 1; | 152 | rev.verbose_header = 1; |
120 | rev.show_root_diff = 0; | 153 | rev.show_root_diff = 0; |
121 | setup_revisions(argc, argv, &rev, NULL); | 154 | setup_revisions(argc, argv, &rev, NULL); |
155 | load_ref_decorations(); | ||
156 | rev.show_decorations = 1; | ||
122 | rev.grep_filter.regflags |= REG_ICASE; | 157 | rev.grep_filter.regflags |= REG_ICASE; |
123 | compile_grep_patterns(&rev.grep_filter); | 158 | compile_grep_patterns(&rev.grep_filter); |
124 | prepare_revision_walk(&rev); | 159 | prepare_revision_walk(&rev); |
@@ -130,7 +165,8 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
130 | "<th class='left'>Commit message"); | 165 | "<th class='left'>Commit message"); |
131 | if (pager) { | 166 | if (pager) { |
132 | html(" ("); | 167 | html(" ("); |
133 | cgit_log_link("toggle", NULL, NULL, ctx.qry.head, ctx.qry.sha1, | 168 | cgit_log_link(ctx.qry.showmsg ? "Collapse" : "Expand", NULL, |
169 | NULL, ctx.qry.head, ctx.qry.sha1, | ||
134 | ctx.qry.path, ctx.qry.ofs, ctx.qry.grep, | 170 | ctx.qry.path, ctx.qry.ofs, ctx.qry.grep, |
135 | ctx.qry.search, ctx.qry.showmsg ? 0 : 1); | 171 | ctx.qry.search, ctx.qry.showmsg ? 0 : 1); |
136 | html(")"); | 172 | html(")"); |