diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | cgit.css | 29 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | ui-commit.c | 15 | ||||
-rw-r--r-- | ui-log.c | 12 | ||||
-rw-r--r-- | ui-refs.c | 26 |
6 files changed, 72 insertions, 13 deletions
diff --git a/Makefile b/Makefile index 8b426fe..3e5a38d 100644 --- a/Makefile +++ b/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | CGIT_VERSION = v0.8.3.2 | 1 | CGIT_VERSION = v0.8.3.3 |
2 | CGIT_SCRIPT_NAME = cgit.cgi | 2 | CGIT_SCRIPT_NAME = cgit.cgi |
3 | CGIT_SCRIPT_PATH = /var/www/htdocs/cgit | 3 | CGIT_SCRIPT_PATH = /var/www/htdocs/cgit |
4 | CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH) | 4 | CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH) |
diff --git a/cgit.css b/cgit.css index 6e47eb3..0c88b65 100644 --- a/cgit.css +++ b/cgit.css | |||
@@ -164,6 +164,17 @@ table.list td.logmsg { | |||
164 | padding: 1em 0.5em 2em 0.5em; | 164 | padding: 1em 0.5em 2em 0.5em; |
165 | } | 165 | } |
166 | 166 | ||
167 | table.list td.lognotes-label { | ||
168 | text-align:right; | ||
169 | vertical-align:top; | ||
170 | } | ||
171 | |||
172 | table.list td.lognotes { | ||
173 | font-family: monospace; | ||
174 | white-space: pre; | ||
175 | padding: 0em 0.5em 2em 0.5em; | ||
176 | } | ||
177 | |||
167 | table.list td a { | 178 | table.list td a { |
168 | color: black; | 179 | color: black; |
169 | } | 180 | } |
@@ -326,6 +337,24 @@ div.commit-msg { | |||
326 | font-family: monospace; | 337 | font-family: monospace; |
327 | } | 338 | } |
328 | 339 | ||
340 | div.notes-header { | ||
341 | font-weight: bold; | ||
342 | padding-top: 1.5em; | ||
343 | } | ||
344 | |||
345 | div.notes { | ||
346 | white-space: pre; | ||
347 | font-family: monospace; | ||
348 | border: solid 1px #ee9; | ||
349 | background-color: #ffd; | ||
350 | padding: 0.3em 2em 0.3em 1em; | ||
351 | float: left; | ||
352 | } | ||
353 | |||
354 | div.notes-footer { | ||
355 | clear: left; | ||
356 | } | ||
357 | |||
329 | div.diffstat-header { | 358 | div.diffstat-header { |
330 | font-weight: bold; | 359 | font-weight: bold; |
331 | padding-top: 1.5em; | 360 | padding-top: 1.5em; |
diff --git a/cgit.h b/cgit.h index 232099d..4090cd4 100644 --- a/cgit.h +++ b/cgit.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <xdiff-interface.h> | 19 | #include <xdiff-interface.h> |
20 | #include <xdiff/xdiff.h> | 20 | #include <xdiff/xdiff.h> |
21 | #include <utf8.h> | 21 | #include <utf8.h> |
22 | #include <notes.h> | ||
22 | 23 | ||
23 | 24 | ||
24 | /* | 25 | /* |
diff --git a/ui-commit.c b/ui-commit.c index a11bc5f..45af450 100644 --- a/ui-commit.c +++ b/ui-commit.c | |||
@@ -17,6 +17,7 @@ void cgit_print_commit(char *hex, const char *prefix) | |||
17 | struct commit *commit, *parent; | 17 | struct commit *commit, *parent; |
18 | struct commitinfo *info, *parent_info; | 18 | struct commitinfo *info, *parent_info; |
19 | struct commit_list *p; | 19 | struct commit_list *p; |
20 | struct strbuf notes = STRBUF_INIT; | ||
20 | unsigned char sha1[20]; | 21 | unsigned char sha1[20]; |
21 | char *tmp, *tmp2; | 22 | char *tmp, *tmp2; |
22 | int parents = 0; | 23 | int parents = 0; |
@@ -35,6 +36,8 @@ void cgit_print_commit(char *hex, const char *prefix) | |||
35 | } | 36 | } |
36 | info = cgit_parse_commit(commit); | 37 | info = cgit_parse_commit(commit); |
37 | 38 | ||
39 | get_commit_notes(commit, ¬es, PAGE_ENCODING, 0); | ||
40 | |||
38 | load_ref_decorations(DECORATE_FULL_REFS); | 41 | load_ref_decorations(DECORATE_FULL_REFS); |
39 | 42 | ||
40 | html("<table summary='commit info' class='commit-info'>\n"); | 43 | html("<table summary='commit info' class='commit-info'>\n"); |
@@ -120,6 +123,17 @@ void cgit_print_commit(char *hex, const char *prefix) | |||
120 | if (ctx.repo->commit_filter) | 123 | if (ctx.repo->commit_filter) |
121 | cgit_close_filter(ctx.repo->commit_filter); | 124 | cgit_close_filter(ctx.repo->commit_filter); |
122 | html("</div>"); | 125 | html("</div>"); |
126 | if (notes.len != 0) { | ||
127 | html("<div class='notes-header'>Notes</div>"); | ||
128 | html("<div class='notes'>"); | ||
129 | if (ctx.repo->commit_filter) | ||
130 | cgit_open_filter(ctx.repo->commit_filter); | ||
131 | html_txt(notes.buf); | ||
132 | if (ctx.repo->commit_filter) | ||
133 | cgit_close_filter(ctx.repo->commit_filter); | ||
134 | html("</div>"); | ||
135 | html("<div class='notes-footer'></div>"); | ||
136 | } | ||
123 | if (parents < 3) { | 137 | if (parents < 3) { |
124 | if (parents) | 138 | if (parents) |
125 | tmp = sha1_to_hex(commit->parents->item->object.sha1); | 139 | tmp = sha1_to_hex(commit->parents->item->object.sha1); |
@@ -127,5 +141,6 @@ void cgit_print_commit(char *hex, const char *prefix) | |||
127 | tmp = NULL; | 141 | tmp = NULL; |
128 | cgit_print_diff(ctx.qry.sha1, tmp, prefix); | 142 | cgit_print_diff(ctx.qry.sha1, tmp, prefix); |
129 | } | 143 | } |
144 | strbuf_release(¬es); | ||
130 | cgit_free_commitinfo(info); | 145 | cgit_free_commitinfo(info); |
131 | } | 146 | } |
diff --git a/ui-log.c b/ui-log.c index ee93653..7f38d2a 100644 --- a/ui-log.c +++ b/ui-log.c | |||
@@ -111,6 +111,9 @@ void print_commit(struct commit *commit) | |||
111 | } | 111 | } |
112 | html("</td></tr>\n"); | 112 | html("</td></tr>\n"); |
113 | if (ctx.qry.showmsg) { | 113 | if (ctx.qry.showmsg) { |
114 | struct strbuf notes = STRBUF_INIT; | ||
115 | get_commit_notes(commit, ¬es, PAGE_ENCODING, 0); | ||
116 | |||
114 | if (ctx.repo->enable_log_filecount) { | 117 | if (ctx.repo->enable_log_filecount) { |
115 | cols++; | 118 | cols++; |
116 | if (ctx.repo->enable_log_linecount) | 119 | if (ctx.repo->enable_log_linecount) |
@@ -120,6 +123,15 @@ void print_commit(struct commit *commit) | |||
120 | cols); | 123 | cols); |
121 | html_txt(info->msg); | 124 | html_txt(info->msg); |
122 | html("</td></tr>\n"); | 125 | html("</td></tr>\n"); |
126 | if (notes.len != 0) { | ||
127 | html("<tr class='nohover'>"); | ||
128 | html("<td class='lognotes-label'>Notes:</td>"); | ||
129 | htmlf("<td colspan='%d' class='lognotes'>", | ||
130 | cols); | ||
131 | html_txt(notes.buf); | ||
132 | html("</td></tr>\n"); | ||
133 | } | ||
134 | strbuf_release(¬es); | ||
123 | } | 135 | } |
124 | cgit_free_commitinfo(info); | 136 | cgit_free_commitinfo(info); |
125 | } | 137 | } |
diff --git a/ui-refs.c b/ui-refs.c index 94ff6be..caddfbc 100644 --- a/ui-refs.c +++ b/ui-refs.c | |||
@@ -42,23 +42,25 @@ static int cmp_branch_age(const void *a, const void *b) | |||
42 | return cmp_age(r1->commit->committer_date, r2->commit->committer_date); | 42 | return cmp_age(r1->commit->committer_date, r2->commit->committer_date); |
43 | } | 43 | } |
44 | 44 | ||
45 | static int get_ref_age(struct refinfo *ref) | ||
46 | { | ||
47 | if (!ref->object) | ||
48 | return 0; | ||
49 | switch (ref->object->type) { | ||
50 | case OBJ_TAG: | ||
51 | return ref->tag ? ref->tag->tagger_date : 0; | ||
52 | case OBJ_COMMIT: | ||
53 | return ref->commit ? ref->commit->committer_date : 0; | ||
54 | } | ||
55 | return 0; | ||
56 | } | ||
57 | |||
45 | static int cmp_tag_age(const void *a, const void *b) | 58 | static int cmp_tag_age(const void *a, const void *b) |
46 | { | 59 | { |
47 | struct refinfo *r1 = *(struct refinfo **)a; | 60 | struct refinfo *r1 = *(struct refinfo **)a; |
48 | struct refinfo *r2 = *(struct refinfo **)b; | 61 | struct refinfo *r2 = *(struct refinfo **)b; |
49 | int r1date, r2date; | ||
50 | |||
51 | if (r1->object->type != OBJ_COMMIT) | ||
52 | r1date = r1->tag->tagger_date; | ||
53 | else | ||
54 | r1date = r1->commit->committer_date; | ||
55 | |||
56 | if (r2->object->type != OBJ_COMMIT) | ||
57 | r2date = r2->tag->tagger_date; | ||
58 | else | ||
59 | r2date = r2->commit->committer_date; | ||
60 | 62 | ||
61 | return cmp_age(r1date, r2date); | 63 | return cmp_age(get_ref_age(r1), get_ref_age(r2)); |
62 | } | 64 | } |
63 | 65 | ||
64 | static int print_branch(struct refinfo *ref) | 66 | static int print_branch(struct refinfo *ref) |