-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | cgit.c | 3 | ||||
-rw-r--r-- | cgit.css | 6 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | cgitrc.5.txt | 4 | ||||
m--------- | git | 0 | ||||
-rw-r--r-- | ui-commit.c | 2 | ||||
-rw-r--r-- | ui-log.c | 2 | ||||
-rw-r--r-- | ui-plain.c | 3 | ||||
-rw-r--r-- | ui-tree.c | 25 |
10 files changed, 32 insertions, 16 deletions
@@ -1,16 +1,16 @@ | |||
1 | CGIT_VERSION = v0.8.2.1 | 1 | CGIT_VERSION = v0.8.2.1 |
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) |
5 | CGIT_CONFIG = /etc/cgitrc | 5 | CGIT_CONFIG = /etc/cgitrc |
6 | CACHE_ROOT = /var/cache/cgit | 6 | CACHE_ROOT = /var/cache/cgit |
7 | SHA1_HEADER = <openssl/sha.h> | 7 | SHA1_HEADER = <openssl/sha.h> |
8 | GIT_VER = 1.6.3.4 | 8 | GIT_VER = 1.6.4.3 |
9 | GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2 | 9 | GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2 |
10 | INSTALL = install | 10 | INSTALL = 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 | ||
@@ -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; |
@@ -232,26 +232,26 @@ td.ls-mode { | |||
232 | } | 232 | } |
233 | 233 | ||
234 | table.blob { | 234 | table.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 | ||
239 | table.blob td.lines { | 239 | table.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 | ||
245 | table.blob td.linenumbers { | 245 | table.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 | ||
252 | table.blob pre { | 252 | table.blob pre { |
253 | padding: 0; margin: 0; | 253 | padding: 0; margin: 0; |
254 | } | 254 | } |
255 | 255 | ||
256 | table.blob a.no { | 256 | table.blob a.no { |
257 | color: gray; | 257 | color: gray; |
@@ -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 | ||
105 | enable-log-linecount:: | 105 | enable-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 | ||
110 | enable-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 | |||
110 | favicon:: | 114 | favicon:: |
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 | ||
115 | footer:: | 119 | footer:: |
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 | } |
@@ -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 | ||
@@ -55,17 +55,18 @@ static void print_object(const unsigned char *sha1, const char *path) | |||
55 | 55 | ||
56 | static int walk_tree(const unsigned char *sha1, const char *base, int baselen, | 56 | static 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 | ||
69 | void cgit_print_plain(struct cgit_context *ctx) | 70 | void cgit_print_plain(struct cgit_context *ctx) |
70 | { | 71 | { |
71 | const char *rev = ctx->qry.sha1; | 72 | const char *rev = ctx->qry.sha1; |
@@ -17,39 +17,46 @@ int header = 0; | |||
17 | 17 | ||
18 | static void print_text_buffer(const char *name, char *buf, unsigned long size) | 18 | static 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 | ||
55 | static void print_binary_buffer(char *buf, unsigned long size) | 62 | static void print_binary_buffer(char *buf, unsigned long size) |