summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile6
-rw-r--r--cgit.css24
m---------git0
-rw-r--r--shared.c4
-rwxr-xr-xtests/t0104-tree.sh2
-rw-r--r--ui-log.c35
-rw-r--r--ui-patch.c4
-rw-r--r--ui-refs.c2
-rw-r--r--ui-tree.c6
9 files changed, 73 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 2e51c31..036fcd7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,13 @@
1CGIT_VERSION = v0.8.1 1CGIT_VERSION = v0.8.1
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_CONFIG = /etc/cgitrc 4CGIT_CONFIG = /etc/cgitrc
5CACHE_ROOT = /var/cache/cgit 5CACHE_ROOT = /var/cache/cgit
6SHA1_HEADER = <openssl/sha.h> 6SHA1_HEADER = <openssl/sha.h>
7GIT_VER = 1.6.0.3 7GIT_VER = 1.6.1
8GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2 8GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2
9 9
10# Define NO_STRCASESTR if you don't have strcasestr. 10# Define NO_STRCASESTR if you don't have strcasestr.
11# 11#
12# Define NEEDS_LIBICONV if linking with libc is not enough (eg. Darwin). 12# Define NEEDS_LIBICONV if linking with libc is not enough (eg. Darwin).
13# 13#
@@ -125,14 +125,14 @@ cgit: $(OBJECTS) libgit
125 125
126cgit.o: VERSION 126cgit.o: VERSION
127 127
128-include $(OBJECTS:.o=.d) 128-include $(OBJECTS:.o=.d)
129 129
130libgit: 130libgit:
131 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) libgit.a 131 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 libgit.a
132 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) xdiff/lib.a 132 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 xdiff/lib.a
133 133
134test: all 134test: all
135 $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all 135 $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all
136 136
137install: all 137install: all
138 mkdir -p $(DESTDIR)$(CGIT_SCRIPT_PATH) 138 mkdir -p $(DESTDIR)$(CGIT_SCRIPT_PATH)
diff --git a/cgit.css b/cgit.css
index 7928c2f..f19446d 100644
--- a/cgit.css
+++ b/cgit.css
@@ -468,6 +468,30 @@ span.age-years {
468div.footer { 468div.footer {
469 margin-top: 0.5em; 469 margin-top: 0.5em;
470 text-align: center; 470 text-align: center;
471 font-size: 80%; 471 font-size: 80%;
472 color: #ccc; 472 color: #ccc;
473} 473}
474a.branch-deco {
475 margin: 0px 0.5em;
476 padding: 0px 0.25em;
477 background-color: #88ff88;
478 border: solid 1px #007700;
479}
480a.tag-deco {
481 margin: 0px 0.5em;
482 padding: 0px 0.25em;
483 background-color: #ffff88;
484 border: solid 1px #777700;
485}
486a.remote-deco {
487 margin: 0px 0.5em;
488 padding: 0px 0.25em;
489 background-color: #ccccff;
490 border: solid 1px #000077;
491}
492a.deco {
493 margin: 0px 0.5em;
494 padding: 0px 0.25em;
495 background-color: #ff8888;
496 border: solid 1px #770000;
497}
diff --git a/git b/git
Subproject 031e6c898f61db1ae0c0be641eac6532c1000d5 Subproject 8104ebfe8276657ee803cca7eb8665a78cf3ef8
diff --git a/shared.c b/shared.c
index 89d1bab..a764c4d 100644
--- a/shared.c
+++ b/shared.c
@@ -264,16 +264,18 @@ int cgit_diff_files(const unsigned char *old_sha1,
264 xdemitconf_t emit_params; 264 xdemitconf_t emit_params;
265 xdemitcb_t emit_cb; 265 xdemitcb_t emit_cb;
266 266
267 if (!load_mmfile(&file1, old_sha1) || !load_mmfile(&file2, new_sha1)) 267 if (!load_mmfile(&file1, old_sha1) || !load_mmfile(&file2, new_sha1))
268 return 1; 268 return 1;
269 269
270 memset(&diff_params, 0, sizeof(diff_params));
271 memset(&emit_params, 0, sizeof(emit_params));
272 memset(&emit_cb, 0, sizeof(emit_cb));
270 diff_params.flags = XDF_NEED_MINIMAL; 273 diff_params.flags = XDF_NEED_MINIMAL;
271 emit_params.ctxlen = 3; 274 emit_params.ctxlen = 3;
272 emit_params.flags = XDL_EMIT_FUNCNAMES; 275 emit_params.flags = XDL_EMIT_FUNCNAMES;
273 emit_params.find_func = NULL;
274 emit_cb.outf = filediff_cb; 276 emit_cb.outf = filediff_cb;
275 emit_cb.priv = fn; 277 emit_cb.priv = fn;
276 xdl_diff(&file1, &file2, &diff_params, &emit_params, &emit_cb); 278 xdl_diff(&file1, &file2, &diff_params, &emit_params, &emit_cb);
277 return 0; 279 return 0;
278} 280}
279 281
diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh
index 0d62cc8..33f4eb0 100755
--- a/tests/t0104-tree.sh
+++ b/tests/t0104-tree.sh
@@ -12,13 +12,13 @@ run_test 'generate bar/tree/file-50' 'cgit_url "bar/tree/file-50" >trash/tmp'
12 12
13run_test 'find line 1' ' 13run_test 'find line 1' '
14 grep -e "<a id=.n1. name=.n1. href=.#n1.>1</a>" trash/tmp 14 grep -e "<a id=.n1. name=.n1. href=.#n1.>1</a>" trash/tmp
15' 15'
16 16
17run_test 'no line 2' ' 17run_test 'no line 2' '
18 grep -e "<a id=.n2. name=.n2. href=.#n2.>2</a>" trash/tmp 18 ! grep -e "<a id=.n2. name=.n2. href=.#n2.>2</a>" trash/tmp
19' 19'
20 20
21run_test 'generate foo+bar/tree' 'cgit_url "foo%2bbar/tree" >trash/tmp' 21run_test 'generate foo+bar/tree' 'cgit_url "foo%2bbar/tree" >trash/tmp'
22 22
23run_test 'verify a+b link' ' 23run_test 'verify a+b link' '
24 grep -e "/foo+bar/tree/a+b" trash/tmp 24 grep -e "/foo+bar/tree/a+b" trash/tmp
diff --git a/ui-log.c b/ui-log.c
index 2f90778..c3757dd 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -28,12 +28,44 @@ void inspect_files(struct diff_filepair *pair)
28{ 28{
29 files++; 29 files++;
30 if (ctx.repo->enable_log_linecount) 30 if (ctx.repo->enable_log_linecount)
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
34void 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
34void print_commit(struct commit *commit) 66void print_commit(struct commit *commit)
35{ 67{
36 struct commitinfo *info; 68 struct commitinfo *info;
37 char *tmp; 69 char *tmp;
38 int cols = 2; 70 int cols = 2;
39 71
@@ -46,12 +78,13 @@ void print_commit(struct commit *commit)
46 cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); 78 cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE);
47 html_link_close(); 79 html_link_close();
48 htmlf("</td><td%s>", 80 htmlf("</td><td%s>",
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) {
55 files = 0; 88 files = 0;
56 add_lines = 0; 89 add_lines = 0;
57 rem_lines = 0; 90 rem_lines = 0;
@@ -116,12 +149,14 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
116 init_revisions(&rev, NULL); 149 init_revisions(&rev, NULL);
117 rev.abbrev = DEFAULT_ABBREV; 150 rev.abbrev = DEFAULT_ABBREV;
118 rev.commit_format = CMIT_FMT_DEFAULT; 151 rev.commit_format = CMIT_FMT_DEFAULT;
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);
125 160
126 if (pager) 161 if (pager)
127 html("<table class='list nowrap'>"); 162 html("<table class='list nowrap'>");
diff --git a/ui-patch.c b/ui-patch.c
index e60877d..1d77336 100644
--- a/ui-patch.c
+++ b/ui-patch.c
@@ -98,15 +98,15 @@ void cgit_print_patch(char *hex)
98 98
99 patchname = fmt("%s.patch", sha1_to_hex(sha1)); 99 patchname = fmt("%s.patch", sha1_to_hex(sha1));
100 ctx.page.mimetype = "text/plain"; 100 ctx.page.mimetype = "text/plain";
101 ctx.page.filename = patchname; 101 ctx.page.filename = patchname;
102 cgit_print_http_headers(&ctx); 102 cgit_print_http_headers(&ctx);
103 htmlf("From %s Mon Sep 17 00:00:00 2001\n", sha1_to_hex(sha1)); 103 htmlf("From %s Mon Sep 17 00:00:00 2001\n", sha1_to_hex(sha1));
104 htmlf("From: %s%s\n", info->author, info->author_email); 104 htmlf("From: %s %s\n", info->author, info->author_email);
105 html("Date: "); 105 html("Date: ");
106 cgit_print_date(info->author_date, "%a, %d %b %Y %H:%M:%S %z%n", ctx.cfg.local_time); 106 cgit_print_date(info->author_date, "%a, %d %b %Y %H:%M:%S %z%n", ctx.cfg.local_time);
107 htmlf("Subject: %s\n\n", info->subject); 107 htmlf("Subject: %s\n\n", info->subject);
108 if (info->msg && *info->msg) { 108 if (info->msg && *info->msg) {
109 htmlf("%s", info->msg); 109 htmlf("%s", info->msg);
110 if (info->msg[strlen(info->msg) - 1] != '\n') 110 if (info->msg[strlen(info->msg) - 1] != '\n')
111 html("\n"); 111 html("\n");
112 } 112 }
diff --git a/ui-refs.c b/ui-refs.c
index d61ee7c..c35e694 100644
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -138,13 +138,13 @@ static int print_tag(struct refinfo *ref)
138 } else { 138 } else {
139 if (!header) 139 if (!header)
140 print_tag_header(); 140 print_tag_header();
141 html("<tr><td>"); 141 html("<tr><td>");
142 html_txt(name); 142 html_txt(name);
143 html("</td><td>"); 143 html("</td><td>");
144 if (ctx.repo->snapshots && (tag->tagged->type == OBJ_COMMIT)) 144 if (ctx.repo->snapshots && (ref->object->type == OBJ_COMMIT))
145 print_tag_downloads(ctx.repo, name); 145 print_tag_downloads(ctx.repo, name);
146 else 146 else
147 cgit_object_link(ref->object); 147 cgit_object_link(ref->object);
148 html("</td></tr>\n"); 148 html("</td></tr>\n");
149 } 149 }
150 return 0; 150 return 0;
diff --git a/ui-tree.c b/ui-tree.c
index 051db7c..9876c99 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -51,14 +51,16 @@ static void print_object(const unsigned char *sha1, char *path)
51 html_txt(buf + start); 51 html_txt(buf + start);
52 html("</td></tr>\n"); 52 html("</td></tr>\n");
53 start = idx + 1; 53 start = idx + 1;
54 } 54 }
55 idx++; 55 idx++;
56 } 56 }
57 htmlf(linefmt, ++lineno); 57 if (start < idx) {
58 html_txt(buf + start); 58 htmlf(linefmt, ++lineno);
59 html_txt(buf + start);
60 }
59 html("</td></tr>\n"); 61 html("</td></tr>\n");
60 html("</table>\n"); 62 html("</table>\n");
61} 63}
62 64
63 65
64static int ls_item(const unsigned char *sha1, const char *base, int baselen, 66static int ls_item(const unsigned char *sha1, const char *base, int baselen,