summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile2
-rw-r--r--cgit.css29
-rw-r--r--cgit.h1
-rw-r--r--ui-commit.c15
-rw-r--r--ui-log.c12
-rw-r--r--ui-refs.c26
6 files changed, 72 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 8b426fe..3e5a38d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,25 +1,25 @@
1CGIT_VERSION = v0.8.3.2 1CGIT_VERSION = v0.8.3.3
2CGIT_SCRIPT_NAME = cgit.cgi 2CGIT_SCRIPT_NAME = cgit.cgi
3CGIT_SCRIPT_PATH = /var/www/htdocs/cgit 3CGIT_SCRIPT_PATH = /var/www/htdocs/cgit
4CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH) 4CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH)
5CGIT_CONFIG = /etc/cgitrc 5CGIT_CONFIG = /etc/cgitrc
6CACHE_ROOT = /var/cache/cgit 6CACHE_ROOT = /var/cache/cgit
7SHA1_HEADER = <openssl/sha.h> 7SHA1_HEADER = <openssl/sha.h>
8GIT_VER = 1.7.0 8GIT_VER = 1.7.0
9GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2 9GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2
10INSTALL = install 10INSTALL = install
11 11
12# Define NO_STRCASESTR if you don't have strcasestr. 12# Define NO_STRCASESTR if you don't have strcasestr.
13# 13#
14# Define NO_OPENSSL to disable linking with OpenSSL and use bundled SHA1 14# Define NO_OPENSSL to disable linking with OpenSSL and use bundled SHA1
15# implementation (slower). 15# implementation (slower).
16# 16#
17# Define NEEDS_LIBICONV if linking with libc is not enough (eg. Darwin). 17# Define NEEDS_LIBICONV if linking with libc is not enough (eg. Darwin).
18# 18#
19 19
20#-include config.mak 20#-include config.mak
21 21
22# 22#
23# Platform specific tweaks 23# Platform specific tweaks
24# 24#
25 25
diff --git a/cgit.css b/cgit.css
index 6e47eb3..0c88b65 100644
--- a/cgit.css
+++ b/cgit.css
@@ -143,48 +143,59 @@ table.list th {
143 /* color: #888; 143 /* color: #888;
144 border-top: dashed 1px #888; 144 border-top: dashed 1px #888;
145 border-bottom: dashed 1px #888; 145 border-bottom: dashed 1px #888;
146 */ 146 */
147 padding: 0.1em 0.5em 0.05em 0.5em; 147 padding: 0.1em 0.5em 0.05em 0.5em;
148 vertical-align: baseline; 148 vertical-align: baseline;
149} 149}
150 150
151table.list td { 151table.list td {
152 border: none; 152 border: none;
153 padding: 0.1em 0.5em 0.1em 0.5em; 153 padding: 0.1em 0.5em 0.1em 0.5em;
154} 154}
155 155
156table.list td.logsubject { 156table.list td.logsubject {
157 font-family: monospace; 157 font-family: monospace;
158 font-weight: bold; 158 font-weight: bold;
159} 159}
160 160
161table.list td.logmsg { 161table.list td.logmsg {
162 font-family: monospace; 162 font-family: monospace;
163 white-space: pre; 163 white-space: pre;
164 padding: 1em 0.5em 2em 0.5em; 164 padding: 1em 0.5em 2em 0.5em;
165} 165}
166 166
167table.list td.lognotes-label {
168 text-align:right;
169 vertical-align:top;
170}
171
172table.list td.lognotes {
173 font-family: monospace;
174 white-space: pre;
175 padding: 0em 0.5em 2em 0.5em;
176}
177
167table.list td a { 178table.list td a {
168 color: black; 179 color: black;
169} 180}
170 181
171table.list td a.ls-dir { 182table.list td a.ls-dir {
172 font-weight: bold; 183 font-weight: bold;
173 color: #00f; 184 color: #00f;
174} 185}
175 186
176table.list td a:hover { 187table.list td a:hover {
177 color: #00f; 188 color: #00f;
178} 189}
179 190
180img { 191img {
181 border: none; 192 border: none;
182} 193}
183 194
184input#switch-btn { 195input#switch-btn {
185 margin: 2px 0px 0px 0px; 196 margin: 2px 0px 0px 0px;
186} 197}
187 198
188td#sidebar input.txt { 199td#sidebar input.txt {
189 width: 100%; 200 width: 100%;
190 margin: 2px 0px 0px 0px; 201 margin: 2px 0px 0px 0px;
@@ -305,48 +316,66 @@ table.commit-info {
305table.commit-info th { 316table.commit-info th {
306 text-align: left; 317 text-align: left;
307 font-weight: normal; 318 font-weight: normal;
308 padding: 0.1em 1em 0.1em 0.1em; 319 padding: 0.1em 1em 0.1em 0.1em;
309 vertical-align: top; 320 vertical-align: top;
310} 321}
311 322
312table.commit-info td { 323table.commit-info td {
313 font-weight: normal; 324 font-weight: normal;
314 padding: 0.1em 1em 0.1em 0.1em; 325 padding: 0.1em 1em 0.1em 0.1em;
315} 326}
316 327
317div.commit-subject { 328div.commit-subject {
318 font-weight: bold; 329 font-weight: bold;
319 font-size: 125%; 330 font-size: 125%;
320 margin: 1.5em 0em 0.5em 0em; 331 margin: 1.5em 0em 0.5em 0em;
321 padding: 0em; 332 padding: 0em;
322} 333}
323 334
324div.commit-msg { 335div.commit-msg {
325 white-space: pre; 336 white-space: pre;
326 font-family: monospace; 337 font-family: monospace;
327} 338}
328 339
340div.notes-header {
341 font-weight: bold;
342 padding-top: 1.5em;
343}
344
345div.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
354div.notes-footer {
355 clear: left;
356}
357
329div.diffstat-header { 358div.diffstat-header {
330 font-weight: bold; 359 font-weight: bold;
331 padding-top: 1.5em; 360 padding-top: 1.5em;
332} 361}
333 362
334table.diffstat { 363table.diffstat {
335 border-collapse: collapse; 364 border-collapse: collapse;
336 border: solid 1px #aaa; 365 border: solid 1px #aaa;
337 background-color: #eee; 366 background-color: #eee;
338} 367}
339 368
340table.diffstat th { 369table.diffstat th {
341 font-weight: normal; 370 font-weight: normal;
342 text-align: left; 371 text-align: left;
343 text-decoration: underline; 372 text-decoration: underline;
344 padding: 0.1em 1em 0.1em 0.1em; 373 padding: 0.1em 1em 0.1em 0.1em;
345 font-size: 100%; 374 font-size: 100%;
346} 375}
347 376
348table.diffstat td { 377table.diffstat td {
349 padding: 0.2em 0.2em 0.1em 0.1em; 378 padding: 0.2em 0.2em 0.1em 0.1em;
350 font-size: 100%; 379 font-size: 100%;
351 border: none; 380 border: none;
352} 381}
diff --git a/cgit.h b/cgit.h
index 232099d..4090cd4 100644
--- a/cgit.h
+++ b/cgit.h
@@ -1,45 +1,46 @@
1#ifndef CGIT_H 1#ifndef CGIT_H
2#define CGIT_H 2#define CGIT_H
3 3
4 4
5#include <git-compat-util.h> 5#include <git-compat-util.h>
6#include <cache.h> 6#include <cache.h>
7#include <grep.h> 7#include <grep.h>
8#include <object.h> 8#include <object.h>
9#include <tree.h> 9#include <tree.h>
10#include <commit.h> 10#include <commit.h>
11#include <tag.h> 11#include <tag.h>
12#include <diff.h> 12#include <diff.h>
13#include <diffcore.h> 13#include <diffcore.h>
14#include <refs.h> 14#include <refs.h>
15#include <revision.h> 15#include <revision.h>
16#include <log-tree.h> 16#include <log-tree.h>
17#include <archive.h> 17#include <archive.h>
18#include <string-list.h> 18#include <string-list.h>
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/*
25 * Dateformats used on misc. pages 26 * Dateformats used on misc. pages
26 */ 27 */
27#define FMT_LONGDATE "%Y-%m-%d %H:%M:%S (%Z)" 28#define FMT_LONGDATE "%Y-%m-%d %H:%M:%S (%Z)"
28#define FMT_SHORTDATE "%Y-%m-%d" 29#define FMT_SHORTDATE "%Y-%m-%d"
29#define FMT_ATOMDATE "%Y-%m-%dT%H:%M:%SZ" 30#define FMT_ATOMDATE "%Y-%m-%dT%H:%M:%SZ"
30 31
31 32
32/* 33/*
33 * Limits used for relative dates 34 * Limits used for relative dates
34 */ 35 */
35#define TM_MIN 60 36#define TM_MIN 60
36#define TM_HOUR (TM_MIN * 60) 37#define TM_HOUR (TM_MIN * 60)
37#define TM_DAY (TM_HOUR * 24) 38#define TM_DAY (TM_HOUR * 24)
38#define TM_WEEK (TM_DAY * 7) 39#define TM_WEEK (TM_DAY * 7)
39#define TM_YEAR (TM_DAY * 365) 40#define TM_YEAR (TM_DAY * 365)
40#define TM_MONTH (TM_YEAR / 12.0) 41#define TM_MONTH (TM_YEAR / 12.0)
41 42
42 43
43/* 44/*
44 * Default encoding 45 * Default encoding
45 */ 46 */
diff --git a/ui-commit.c b/ui-commit.c
index a11bc5f..45af450 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -1,61 +1,64 @@
1/* ui-commit.c: generate commit view 1/* ui-commit.c: generate commit view
2 * 2 *
3 * Copyright (C) 2006 Lars Hjemli 3 * Copyright (C) 2006 Lars Hjemli
4 * 4 *
5 * Licensed under GNU General Public License v2 5 * Licensed under GNU General Public License v2
6 * (see COPYING for full license text) 6 * (see COPYING for full license text)
7 */ 7 */
8 8
9#include "cgit.h" 9#include "cgit.h"
10#include "html.h" 10#include "html.h"
11#include "ui-shared.h" 11#include "ui-shared.h"
12#include "ui-diff.h" 12#include "ui-diff.h"
13#include "ui-log.h" 13#include "ui-log.h"
14 14
15void cgit_print_commit(char *hex, const char *prefix) 15void cgit_print_commit(char *hex, const char *prefix)
16{ 16{
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;
23 24
24 if (!hex) 25 if (!hex)
25 hex = ctx.qry.head; 26 hex = ctx.qry.head;
26 27
27 if (get_sha1(hex, sha1)) { 28 if (get_sha1(hex, sha1)) {
28 cgit_print_error(fmt("Bad object id: %s", hex)); 29 cgit_print_error(fmt("Bad object id: %s", hex));
29 return; 30 return;
30 } 31 }
31 commit = lookup_commit_reference(sha1); 32 commit = lookup_commit_reference(sha1);
32 if (!commit) { 33 if (!commit) {
33 cgit_print_error(fmt("Bad commit reference: %s", hex)); 34 cgit_print_error(fmt("Bad commit reference: %s", hex));
34 return; 35 return;
35 } 36 }
36 info = cgit_parse_commit(commit); 37 info = cgit_parse_commit(commit);
37 38
39 get_commit_notes(commit, &notes, 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");
41 html("<tr><th>author</th><td>"); 44 html("<tr><th>author</th><td>");
42 html_txt(info->author); 45 html_txt(info->author);
43 if (!ctx.cfg.noplainemail) { 46 if (!ctx.cfg.noplainemail) {
44 html(" "); 47 html(" ");
45 html_txt(info->author_email); 48 html_txt(info->author_email);
46 } 49 }
47 html("</td><td class='right'>"); 50 html("</td><td class='right'>");
48 cgit_print_date(info->author_date, FMT_LONGDATE, ctx.cfg.local_time); 51 cgit_print_date(info->author_date, FMT_LONGDATE, ctx.cfg.local_time);
49 html("</td></tr>\n"); 52 html("</td></tr>\n");
50 html("<tr><th>committer</th><td>"); 53 html("<tr><th>committer</th><td>");
51 html_txt(info->committer); 54 html_txt(info->committer);
52 if (!ctx.cfg.noplainemail) { 55 if (!ctx.cfg.noplainemail) {
53 html(" "); 56 html(" ");
54 html_txt(info->committer_email); 57 html_txt(info->committer_email);
55 } 58 }
56 html("</td><td class='right'>"); 59 html("</td><td class='right'>");
57 cgit_print_date(info->committer_date, FMT_LONGDATE, ctx.cfg.local_time); 60 cgit_print_date(info->committer_date, FMT_LONGDATE, ctx.cfg.local_time);
58 html("</td></tr>\n"); 61 html("</td></tr>\n");
59 html("<tr><th>commit</th><td colspan='2' class='sha1'>"); 62 html("<tr><th>commit</th><td colspan='2' class='sha1'>");
60 tmp = sha1_to_hex(commit->object.sha1); 63 tmp = sha1_to_hex(commit->object.sha1);
61 cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, prefix, 0); 64 cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, prefix, 0);
@@ -99,33 +102,45 @@ void cgit_print_commit(char *hex, const char *prefix)
99 parents++; 102 parents++;
100 } 103 }
101 if (ctx.repo->snapshots) { 104 if (ctx.repo->snapshots) {
102 html("<tr><th>download</th><td colspan='2' class='sha1'>"); 105 html("<tr><th>download</th><td colspan='2' class='sha1'>");
103 cgit_print_snapshot_links(ctx.qry.repo, ctx.qry.head, 106 cgit_print_snapshot_links(ctx.qry.repo, ctx.qry.head,
104 hex, ctx.repo->snapshots); 107 hex, ctx.repo->snapshots);
105 html("</td></tr>"); 108 html("</td></tr>");
106 } 109 }
107 html("</table>\n"); 110 html("</table>\n");
108 html("<div class='commit-subject'>"); 111 html("<div class='commit-subject'>");
109 if (ctx.repo->commit_filter) 112 if (ctx.repo->commit_filter)
110 cgit_open_filter(ctx.repo->commit_filter); 113 cgit_open_filter(ctx.repo->commit_filter);
111 html_txt(info->subject); 114 html_txt(info->subject);
112 if (ctx.repo->commit_filter) 115 if (ctx.repo->commit_filter)
113 cgit_close_filter(ctx.repo->commit_filter); 116 cgit_close_filter(ctx.repo->commit_filter);
114 show_commit_decorations(commit); 117 show_commit_decorations(commit);
115 html("</div>"); 118 html("</div>");
116 html("<div class='commit-msg'>"); 119 html("<div class='commit-msg'>");
117 if (ctx.repo->commit_filter) 120 if (ctx.repo->commit_filter)
118 cgit_open_filter(ctx.repo->commit_filter); 121 cgit_open_filter(ctx.repo->commit_filter);
119 html_txt(info->msg); 122 html_txt(info->msg);
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);
126 else 140 else
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(&notes);
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
@@ -90,57 +90,69 @@ void print_commit(struct commit *commit)
90 html_link_open(tmp, NULL, NULL); 90 html_link_open(tmp, NULL, NULL);
91 cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); 91 cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE);
92 html_link_close(); 92 html_link_close();
93 htmlf("</td><td%s>", 93 htmlf("</td><td%s>",
94 ctx.qry.showmsg ? " class='logsubject'" : ""); 94 ctx.qry.showmsg ? " class='logsubject'" : "");
95 cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, 95 cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head,
96 sha1_to_hex(commit->object.sha1), ctx.qry.vpath, 0); 96 sha1_to_hex(commit->object.sha1), ctx.qry.vpath, 0);
97 show_commit_decorations(commit); 97 show_commit_decorations(commit);
98 html("</td><td>"); 98 html("</td><td>");
99 html_txt(info->author); 99 html_txt(info->author);
100 if (ctx.repo->enable_log_filecount) { 100 if (ctx.repo->enable_log_filecount) {
101 files = 0; 101 files = 0;
102 add_lines = 0; 102 add_lines = 0;
103 rem_lines = 0; 103 rem_lines = 0;
104 cgit_diff_commit(commit, inspect_files); 104 cgit_diff_commit(commit, inspect_files);
105 html("</td><td>"); 105 html("</td><td>");
106 htmlf("%d", files); 106 htmlf("%d", files);
107 if (ctx.repo->enable_log_linecount) { 107 if (ctx.repo->enable_log_linecount) {
108 html("</td><td>"); 108 html("</td><td>");
109 htmlf("-%d/+%d", rem_lines, add_lines); 109 htmlf("-%d/+%d", rem_lines, add_lines);
110 } 110 }
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, &notes, 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)
117 cols++; 120 cols++;
118 } 121 }
119 htmlf("<tr class='nohover'><td/><td colspan='%d' class='logmsg'>", 122 htmlf("<tr class='nohover'><td/><td colspan='%d' class='logmsg'>",
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(&notes);
123 } 135 }
124 cgit_free_commitinfo(info); 136 cgit_free_commitinfo(info);
125} 137}
126 138
127static const char *disambiguate_ref(const char *ref) 139static const char *disambiguate_ref(const char *ref)
128{ 140{
129 unsigned char sha1[20]; 141 unsigned char sha1[20];
130 const char *longref; 142 const char *longref;
131 143
132 longref = fmt("refs/heads/%s", ref); 144 longref = fmt("refs/heads/%s", ref);
133 if (get_sha1(longref, sha1) == 0) 145 if (get_sha1(longref, sha1) == 0)
134 return longref; 146 return longref;
135 147
136 return ref; 148 return ref;
137} 149}
138 150
139void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, 151void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern,
140 char *path, int pager) 152 char *path, int pager)
141{ 153{
142 struct rev_info rev; 154 struct rev_info rev;
143 struct commit *commit; 155 struct commit *commit;
144 const char *argv[] = {NULL, NULL, NULL, NULL, NULL}; 156 const char *argv[] = {NULL, NULL, NULL, NULL, NULL};
145 int argc = 2; 157 int argc = 2;
146 int i, columns = 3; 158 int i, columns = 3;
diff --git a/ui-refs.c b/ui-refs.c
index 94ff6be..caddfbc 100644
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -21,65 +21,67 @@ static int cmp_age(int age1, int age2)
21 return 0; 21 return 0;
22 22
23 if (age1 == 0) 23 if (age1 == 0)
24 return +1; 24 return +1;
25 25
26 return -1; 26 return -1;
27} 27}
28 28
29static int cmp_ref_name(const void *a, const void *b) 29static int cmp_ref_name(const void *a, const void *b)
30{ 30{
31 struct refinfo *r1 = *(struct refinfo **)a; 31 struct refinfo *r1 = *(struct refinfo **)a;
32 struct refinfo *r2 = *(struct refinfo **)b; 32 struct refinfo *r2 = *(struct refinfo **)b;
33 33
34 return strcmp(r1->refname, r2->refname); 34 return strcmp(r1->refname, r2->refname);
35} 35}
36 36
37static int cmp_branch_age(const void *a, const void *b) 37static int cmp_branch_age(const void *a, const void *b)
38{ 38{
39 struct refinfo *r1 = *(struct refinfo **)a; 39 struct refinfo *r1 = *(struct refinfo **)a;
40 struct refinfo *r2 = *(struct refinfo **)b; 40 struct refinfo *r2 = *(struct refinfo **)b;
41 41
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
45static 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
45static int cmp_tag_age(const void *a, const void *b) 58static 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
64static int print_branch(struct refinfo *ref) 66static int print_branch(struct refinfo *ref)
65{ 67{
66 struct commitinfo *info = ref->commit; 68 struct commitinfo *info = ref->commit;
67 char *name = (char *)ref->refname; 69 char *name = (char *)ref->refname;
68 70
69 if (!info) 71 if (!info)
70 return 1; 72 return 1;
71 html("<tr><td>"); 73 html("<tr><td>");
72 cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL, 74 cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL,
73 ctx.qry.showmsg); 75 ctx.qry.showmsg);
74 html("</td><td>"); 76 html("</td><td>");
75 77
76 if (ref->object->type == OBJ_COMMIT) { 78 if (ref->object->type == OBJ_COMMIT) {
77 cgit_commit_link(info->subject, NULL, NULL, name, NULL, NULL, 0); 79 cgit_commit_link(info->subject, NULL, NULL, name, NULL, NULL, 0);
78 html("</td><td>"); 80 html("</td><td>");
79 html_txt(info->author); 81 html_txt(info->author);
80 html("</td><td colspan='2'>"); 82 html("</td><td colspan='2'>");
81 cgit_print_age(info->commit->date, -1, NULL); 83 cgit_print_age(info->commit->date, -1, NULL);
82 } else { 84 } else {
83 html("</td><td></td><td>"); 85 html("</td><td></td><td>");
84 cgit_object_link(ref->object); 86 cgit_object_link(ref->object);
85 } 87 }