summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2009-08-16 17:52:27 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2009-08-16 18:53:20 (UTC)
commit0730ee6ea4af45e29e7c74d4a32bde9d2d6c8104 (patch) (unidiff)
tree539784d3a0a8c836f8c59a71fd1c9463116a09d2
parent1bbe04c2c09d5dfbb2c66c4f8f490008b6e5fb25 (diff)
downloadcgit-0730ee6ea4af45e29e7c74d4a32bde9d2d6c8104.zip
cgit-0730ee6ea4af45e29e7c74d4a32bde9d2d6c8104.tar.gz
cgit-0730ee6ea4af45e29e7c74d4a32bde9d2d6c8104.tar.bz2
ui-log.c: handle lightweight tags when printing commit decorations
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ui-log.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ui-log.c b/ui-log.c
index ba2ab03..0b37785 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -32,48 +32,52 @@ void inspect_files(struct diff_filepair *pair)
32 32
33 files++; 33 files++;
34 if (ctx.repo->enable_log_linecount) 34 if (ctx.repo->enable_log_linecount)
35 cgit_diff_files(pair->one->sha1, pair->two->sha1, &old_size, 35 cgit_diff_files(pair->one->sha1, pair->two->sha1, &old_size,
36 &new_size, &binary, count_lines); 36 &new_size, &binary, count_lines);
37} 37}
38 38
39void show_commit_decorations(struct commit *commit) 39void show_commit_decorations(struct commit *commit)
40{ 40{
41 struct name_decoration *deco; 41 struct name_decoration *deco;
42 static char buf[1024]; 42 static char buf[1024];
43 43
44 buf[sizeof(buf) - 1] = 0; 44 buf[sizeof(buf) - 1] = 0;
45 deco = lookup_decoration(&name_decoration, &commit->object); 45 deco = lookup_decoration(&name_decoration, &commit->object);
46 while (deco) { 46 while (deco) {
47 if (!prefixcmp(deco->name, "refs/heads/")) { 47 if (!prefixcmp(deco->name, "refs/heads/")) {
48 strncpy(buf, deco->name + 11, sizeof(buf) - 1); 48 strncpy(buf, deco->name + 11, sizeof(buf) - 1);
49 cgit_log_link(buf, NULL, "branch-deco", buf, NULL, NULL, 49 cgit_log_link(buf, NULL, "branch-deco", buf, NULL, NULL,
50 0, NULL, NULL, ctx.qry.showmsg); 50 0, NULL, NULL, ctx.qry.showmsg);
51 } 51 }
52 else if (!prefixcmp(deco->name, "tag: refs/tags/")) { 52 else if (!prefixcmp(deco->name, "tag: refs/tags/")) {
53 strncpy(buf, deco->name + 15, sizeof(buf) - 1); 53 strncpy(buf, deco->name + 15, sizeof(buf) - 1);
54 cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf); 54 cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf);
55 } 55 }
56 else if (!prefixcmp(deco->name, "refs/tags/")) {
57 strncpy(buf, deco->name + 10, sizeof(buf) - 1);
58 cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf);
59 }
56 else if (!prefixcmp(deco->name, "refs/remotes/")) { 60 else if (!prefixcmp(deco->name, "refs/remotes/")) {
57 strncpy(buf, deco->name + 13, sizeof(buf) - 1); 61 strncpy(buf, deco->name + 13, sizeof(buf) - 1);
58 cgit_log_link(buf, NULL, "remote-deco", NULL, 62 cgit_log_link(buf, NULL, "remote-deco", NULL,
59 sha1_to_hex(commit->object.sha1), NULL, 63 sha1_to_hex(commit->object.sha1), NULL,
60 0, NULL, NULL, ctx.qry.showmsg); 64 0, NULL, NULL, ctx.qry.showmsg);
61 } 65 }
62 else { 66 else {
63 strncpy(buf, deco->name, sizeof(buf) - 1); 67 strncpy(buf, deco->name, sizeof(buf) - 1);
64 cgit_commit_link(buf, NULL, "deco", ctx.qry.head, 68 cgit_commit_link(buf, NULL, "deco", ctx.qry.head,
65 sha1_to_hex(commit->object.sha1)); 69 sha1_to_hex(commit->object.sha1));
66 } 70 }
67 deco = deco->next; 71 deco = deco->next;
68 } 72 }
69} 73}
70 74
71void print_commit(struct commit *commit) 75void print_commit(struct commit *commit)
72{ 76{
73 struct commitinfo *info; 77 struct commitinfo *info;
74 char *tmp; 78 char *tmp;
75 int cols = 2; 79 int cols = 2;
76 80
77 info = cgit_parse_commit(commit); 81 info = cgit_parse_commit(commit);
78 htmlf("<tr%s><td>", 82 htmlf("<tr%s><td>",
79 ctx.qry.showmsg ? " class='logheader'" : ""); 83 ctx.qry.showmsg ? " class='logheader'" : "");