summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--Makefile2
-rw-r--r--cgit.c3
-rw-r--r--cgit.css6
-rw-r--r--cgit.h1
-rw-r--r--cgitrc.5.txt4
m---------git0
-rw-r--r--ui-commit.c2
-rw-r--r--ui-log.c2
-rw-r--r--ui-plain.c3
-rw-r--r--ui-tree.c25
10 files changed, 32 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 1f9893a..dc9dffd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,16 +1,16 @@
1CGIT_VERSION = v0.8.2.1 1CGIT_VERSION = v0.8.2.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_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.6.3.4 8GIT_VER = 1.6.4.3
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 NEEDS_LIBICONV if linking with libc is not enough (eg. Darwin). 14# Define NEEDS_LIBICONV if linking with libc is not enough (eg. Darwin).
15# 15#
16 16
diff --git a/cgit.c b/cgit.c
index 3fcca2a..bd37788 100644
--- a/cgit.c
+++ b/cgit.c
@@ -132,16 +132,18 @@ void config_cb(const char *name, const char *value)
132 else if (!strcmp(name, "enable-filter-overrides")) 132 else if (!strcmp(name, "enable-filter-overrides"))
133 ctx.cfg.enable_filter_overrides = atoi(value); 133 ctx.cfg.enable_filter_overrides = atoi(value);
134 else if (!strcmp(name, "enable-index-links")) 134 else if (!strcmp(name, "enable-index-links"))
135 ctx.cfg.enable_index_links = atoi(value); 135 ctx.cfg.enable_index_links = atoi(value);
136 else if (!strcmp(name, "enable-log-filecount")) 136 else if (!strcmp(name, "enable-log-filecount"))
137 ctx.cfg.enable_log_filecount = atoi(value); 137 ctx.cfg.enable_log_filecount = atoi(value);
138 else if (!strcmp(name, "enable-log-linecount")) 138 else if (!strcmp(name, "enable-log-linecount"))
139 ctx.cfg.enable_log_linecount = atoi(value); 139 ctx.cfg.enable_log_linecount = atoi(value);
140 else if (!strcmp(name, "enable-tree-linenumbers"))
141 ctx.cfg.enable_tree_linenumbers = atoi(value);
140 else if (!strcmp(name, "max-stats")) 142 else if (!strcmp(name, "max-stats"))
141 ctx.cfg.max_stats = cgit_find_stats_period(value, NULL); 143 ctx.cfg.max_stats = cgit_find_stats_period(value, NULL);
142 else if (!strcmp(name, "cache-size")) 144 else if (!strcmp(name, "cache-size"))
143 ctx.cfg.cache_size = atoi(value); 145 ctx.cfg.cache_size = atoi(value);
144 else if (!strcmp(name, "cache-root")) 146 else if (!strcmp(name, "cache-root"))
145 ctx.cfg.cache_root = xstrdup(value); 147 ctx.cfg.cache_root = xstrdup(value);
146 else if (!strcmp(name, "cache-root-ttl")) 148 else if (!strcmp(name, "cache-root-ttl"))
147 ctx.cfg.cache_root_ttl = atoi(value); 149 ctx.cfg.cache_root_ttl = atoi(value);
@@ -255,16 +257,17 @@ static void prepare_context(struct cgit_context *ctx)
255 ctx->cfg.cache_repo_ttl = 5; 257 ctx->cfg.cache_repo_ttl = 5;
256 ctx->cfg.cache_root = CGIT_CACHE_ROOT; 258 ctx->cfg.cache_root = CGIT_CACHE_ROOT;
257 ctx->cfg.cache_root_ttl = 5; 259 ctx->cfg.cache_root_ttl = 5;
258 ctx->cfg.cache_scanrc_ttl = 15; 260 ctx->cfg.cache_scanrc_ttl = 15;
259 ctx->cfg.cache_static_ttl = -1; 261 ctx->cfg.cache_static_ttl = -1;
260 ctx->cfg.css = "/cgit.css"; 262 ctx->cfg.css = "/cgit.css";
261 ctx->cfg.logo = "/cgit.png"; 263 ctx->cfg.logo = "/cgit.png";
262 ctx->cfg.local_time = 0; 264 ctx->cfg.local_time = 0;
265 ctx->cfg.enable_tree_linenumbers = 1;
263 ctx->cfg.max_repo_count = 50; 266 ctx->cfg.max_repo_count = 50;
264 ctx->cfg.max_commit_count = 50; 267 ctx->cfg.max_commit_count = 50;
265 ctx->cfg.max_lock_attempts = 5; 268 ctx->cfg.max_lock_attempts = 5;
266 ctx->cfg.max_msg_len = 80; 269 ctx->cfg.max_msg_len = 80;
267 ctx->cfg.max_repodesc_len = 80; 270 ctx->cfg.max_repodesc_len = 80;
268 ctx->cfg.max_stats = 0; 271 ctx->cfg.max_stats = 0;
269 ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; 272 ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s";
270 ctx->cfg.renamelimit = -1; 273 ctx->cfg.renamelimit = -1;
diff --git a/cgit.css b/cgit.css
index 3c65114..c47ebc9 100644
--- a/cgit.css
+++ b/cgit.css
@@ -232,26 +232,26 @@ td.ls-mode {
232} 232}
233 233
234table.blob { 234table.blob {
235 margin-top: 0.5em; 235 margin-top: 0.5em;
236 border-top: solid 1px black; 236 border-top: solid 1px black;
237} 237}
238 238
239table.blob td.lines { 239table.blob td.lines {
240 margin: 0; padding: 0; 240 margin: 0; padding: 0 0 0 0.5em;
241 vertical-align: top; 241 vertical-align: top;
242 color: black; 242 color: black;
243} 243}
244 244
245table.blob td.linenumbers { 245table.blob td.linenumbers {
246 margin: 0; padding: 0; 246 margin: 0; padding: 0 0.5em 0 0.5em;
247 vertical-align: top; 247 vertical-align: top;
248 text-align: right;
248 border-right: 1px solid gray; 249 border-right: 1px solid gray;
249 background-color: #eee;
250} 250}
251 251
252table.blob pre { 252table.blob pre {
253 padding: 0; margin: 0; 253 padding: 0; margin: 0;
254} 254}
255 255
256table.blob a.no { 256table.blob a.no {
257 color: gray; 257 color: gray;
diff --git a/cgit.h b/cgit.h
index ef109aa..6c6c460 100644
--- a/cgit.h
+++ b/cgit.h
@@ -173,16 +173,17 @@ struct cgit_config {
173 int cache_root_ttl; 173 int cache_root_ttl;
174 int cache_scanrc_ttl; 174 int cache_scanrc_ttl;
175 int cache_static_ttl; 175 int cache_static_ttl;
176 int embedded; 176 int embedded;
177 int enable_filter_overrides; 177 int enable_filter_overrides;
178 int enable_index_links; 178 int enable_index_links;
179 int enable_log_filecount; 179 int enable_log_filecount;
180 int enable_log_linecount; 180 int enable_log_linecount;
181 int enable_tree_linenumbers;
181 int local_time; 182 int local_time;
182 int max_repo_count; 183 int max_repo_count;
183 int max_commit_count; 184 int max_commit_count;
184 int max_lock_attempts; 185 int max_lock_attempts;
185 int max_msg_len; 186 int max_msg_len;
186 int max_repodesc_len; 187 int max_repodesc_len;
187 int max_stats; 188 int max_stats;
188 int nocache; 189 int nocache;
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index 617b7c3..4dc383d 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -102,16 +102,20 @@ enable-log-filecount::
102 modified files for each commit on the repository log page. Default 102 modified files for each commit on the repository log page. Default
103 value: "0". 103 value: "0".
104 104
105enable-log-linecount:: 105enable-log-linecount::
106 Flag which, when set to "1", will make cgit print the number of added 106 Flag which, when set to "1", will make cgit print the number of added
107 and removed lines for each commit on the repository log page. Default 107 and removed lines for each commit on the repository log page. Default
108 value: "0". 108 value: "0".
109 109
110enable-tree-linenumbers::
111 Flag which, when set to "1", will make cgit generate linenumber links
112 for plaintext blobs printed in the tree view. Default value: "1".
113
110favicon:: 114favicon::
111 Url used as link to a shortcut icon for cgit. If specified, it is 115 Url used as link to a shortcut icon for cgit. If specified, it is
112 suggested to use the value "/favicon.ico" since certain browsers will 116 suggested to use the value "/favicon.ico" since certain browsers will
113 ignore other values. Default value: none. 117 ignore other values. Default value: none.
114 118
115footer:: 119footer::
116 The content of the file specified with this option will be included 120 The content of the file specified with this option will be included
117 verbatim at the bottom of all pages (i.e. it replaces the standard 121 verbatim at the bottom of all pages (i.e. it replaces the standard
diff --git a/git b/git
Subproject e276f018f2c1f0fc962fbe44a36708d1cdebada Subproject 7fb6bcff2dece2ff9fbc5ebfe526d9b2a7e764c
diff --git a/ui-commit.c b/ui-commit.c
index d6b73ee..f5b0ae5 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -30,17 +30,17 @@ void cgit_print_commit(char *hex)
30 } 30 }
31 commit = lookup_commit_reference(sha1); 31 commit = lookup_commit_reference(sha1);
32 if (!commit) { 32 if (!commit) {
33 cgit_print_error(fmt("Bad commit reference: %s", hex)); 33 cgit_print_error(fmt("Bad commit reference: %s", hex));
34 return; 34 return;
35 } 35 }
36 info = cgit_parse_commit(commit); 36 info = cgit_parse_commit(commit);
37 37
38 load_ref_decorations(); 38 load_ref_decorations(DECORATE_FULL_REFS);
39 39
40 html("<table summary='commit info' class='commit-info'>\n"); 40 html("<table summary='commit info' class='commit-info'>\n");
41 html("<tr><th>author</th><td>"); 41 html("<tr><th>author</th><td>");
42 html_txt(info->author); 42 html_txt(info->author);
43 if (!ctx.cfg.noplainemail) { 43 if (!ctx.cfg.noplainemail) {
44 html(" "); 44 html(" ");
45 html_txt(info->author_email); 45 html_txt(info->author_email);
46 } 46 }
diff --git a/ui-log.c b/ui-log.c
index 0b37785..f3132c9 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -156,17 +156,17 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
156 argv[argc++] = path; 156 argv[argc++] = path;
157 } 157 }
158 init_revisions(&rev, NULL); 158 init_revisions(&rev, NULL);
159 rev.abbrev = DEFAULT_ABBREV; 159 rev.abbrev = DEFAULT_ABBREV;
160 rev.commit_format = CMIT_FMT_DEFAULT; 160 rev.commit_format = CMIT_FMT_DEFAULT;
161 rev.verbose_header = 1; 161 rev.verbose_header = 1;
162 rev.show_root_diff = 0; 162 rev.show_root_diff = 0;
163 setup_revisions(argc, argv, &rev, NULL); 163 setup_revisions(argc, argv, &rev, NULL);
164 load_ref_decorations(); 164 load_ref_decorations(DECORATE_FULL_REFS);
165 rev.show_decorations = 1; 165 rev.show_decorations = 1;
166 rev.grep_filter.regflags |= REG_ICASE; 166 rev.grep_filter.regflags |= REG_ICASE;
167 compile_grep_patterns(&rev.grep_filter); 167 compile_grep_patterns(&rev.grep_filter);
168 prepare_revision_walk(&rev); 168 prepare_revision_walk(&rev);
169 169
170 if (pager) 170 if (pager)
171 html("<table class='list nowrap'>"); 171 html("<table class='list nowrap'>");
172 172
diff --git a/ui-plain.c b/ui-plain.c
index 27c6dae..a4ce077 100644
--- a/ui-plain.c
+++ b/ui-plain.c
@@ -55,17 +55,18 @@ static void print_object(const unsigned char *sha1, const char *path)
55 55
56static int walk_tree(const unsigned char *sha1, const char *base, int baselen, 56static int walk_tree(const unsigned char *sha1, const char *base, int baselen,
57 const char *pathname, unsigned mode, int stage, 57 const char *pathname, unsigned mode, int stage,
58 void *cbdata) 58 void *cbdata)
59{ 59{
60 if (S_ISDIR(mode)) 60 if (S_ISDIR(mode))
61 return READ_TREE_RECURSIVE; 61 return READ_TREE_RECURSIVE;
62 62
63 if (S_ISREG(mode)) 63 if (S_ISREG(mode) && !strncmp(base, match_path, baselen) &&
64 !strcmp(pathname, match_path + baselen))
64 print_object(sha1, pathname); 65 print_object(sha1, pathname);
65 66
66 return 0; 67 return 0;
67} 68}
68 69
69void cgit_print_plain(struct cgit_context *ctx) 70void cgit_print_plain(struct cgit_context *ctx)
70{ 71{
71 const char *rev = ctx->qry.sha1; 72 const char *rev = ctx->qry.sha1;
diff --git a/ui-tree.c b/ui-tree.c
index c608754..f53ab64 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -17,39 +17,46 @@ int header = 0;
17 17
18static void print_text_buffer(const char *name, char *buf, unsigned long size) 18static void print_text_buffer(const char *name, char *buf, unsigned long size)
19{ 19{
20 unsigned long lineno, idx; 20 unsigned long lineno, idx;
21 const char *numberfmt = 21 const char *numberfmt =
22 "<a class='no' id='n%1$d' name='n%1$d' href='#n%1$d'>%1$d</a>\n"; 22 "<a class='no' id='n%1$d' name='n%1$d' href='#n%1$d'>%1$d</a>\n";
23 23
24 html("<table summary='blob content' class='blob'>\n"); 24 html("<table summary='blob content' class='blob'>\n");
25 if (ctx.repo->source_filter) {
26 html("<tr><td class='lines'><pre><code>");
27 ctx.repo->source_filter->argv[1] = xstrdup(name);
28 cgit_open_filter(ctx.repo->source_filter);
29 write(STDOUT_FILENO, buf, size);
30 cgit_close_filter(ctx.repo->source_filter);
31 html("</code></pre></td></tr></table>\n");
32 return;
33 }
34 25
26 if (ctx.cfg.enable_tree_linenumbers) {
35 html("<tr><td class='linenumbers'><pre>"); 27 html("<tr><td class='linenumbers'><pre>");
36 idx = 0; 28 idx = 0;
37 lineno = 0; 29 lineno = 0;
38 30
39 if (size) { 31 if (size) {
40 htmlf(numberfmt, ++lineno); 32 htmlf(numberfmt, ++lineno);
41 while(idx < size - 1) { // skip absolute last newline 33 while(idx < size - 1) { // skip absolute last newline
42 if (buf[idx] == '\n') 34 if (buf[idx] == '\n')
43 htmlf(numberfmt, ++lineno); 35 htmlf(numberfmt, ++lineno);
44 idx++; 36 idx++;
45 } 37 }
46 } 38 }
47 html("</pre></td>\n"); 39 html("</pre></td>\n");
40 }
41 else {
42 html("<tr>\n");
43 }
44
45 if (ctx.repo->source_filter) {
46 html("<td class='lines'><pre><code>");
47 ctx.repo->source_filter->argv[1] = xstrdup(name);
48 cgit_open_filter(ctx.repo->source_filter);
49 write(STDOUT_FILENO, buf, size);
50 cgit_close_filter(ctx.repo->source_filter);
51 html("</code></pre></td></tr></table>\n");
52 return;
53 }
54
48 html("<td class='lines'><pre><code>"); 55 html("<td class='lines'><pre><code>");
49 html_txt(buf); 56 html_txt(buf);
50 html("</code></pre></td></tr></table>\n"); 57 html("</code></pre></td></tr></table>\n");
51} 58}
52 59
53#define ROWLEN 32 60#define ROWLEN 32
54 61
55static void print_binary_buffer(char *buf, unsigned long size) 62static void print_binary_buffer(char *buf, unsigned long size)