diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | cgit.c | 19 | ||||
-rw-r--r-- | cgit.css | 5 | ||||
-rw-r--r-- | cgit.h | 6 | ||||
-rw-r--r-- | cgitrc.5.txt | 14 | ||||
-rw-r--r-- | cmd.c | 2 | ||||
-rw-r--r-- | parsing.c | 4 | ||||
-rw-r--r-- | scan-tree.c | 2 | ||||
-rw-r--r-- | shared.c | 80 | ||||
-rw-r--r-- | ui-atom.c | 4 | ||||
-rw-r--r-- | ui-commit.c | 13 | ||||
-rw-r--r-- | ui-log.c | 11 | ||||
-rw-r--r-- | ui-plain.c | 68 | ||||
-rw-r--r-- | ui-shared.c | 1 |
14 files changed, 205 insertions, 26 deletions
@@ -1,4 +1,4 @@ | |||
1 | CGIT_VERSION = v0.8.3.1 | 1 | CGIT_VERSION = v0.8.3.2 |
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) |
@@ -62,6 +62,8 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value) | |||
62 | repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value); | 62 | repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value); |
63 | else if (!strcmp(name, "enable-remote-branches")) | 63 | else if (!strcmp(name, "enable-remote-branches")) |
64 | repo->enable_remote_branches = atoi(value); | 64 | repo->enable_remote_branches = atoi(value); |
65 | else if (!strcmp(name, "enable-subject-links")) | ||
66 | repo->enable_subject_links = atoi(value); | ||
65 | else if (!strcmp(name, "max-stats")) | 67 | else if (!strcmp(name, "max-stats")) |
66 | repo->max_stats = cgit_find_stats_period(value, NULL); | 68 | repo->max_stats = cgit_find_stats_period(value, NULL); |
67 | else if (!strcmp(name, "module-link")) | 69 | else if (!strcmp(name, "module-link")) |
@@ -141,6 +143,8 @@ void config_cb(const char *name, const char *value) | |||
141 | ctx.cfg.enable_log_linecount = atoi(value); | 143 | ctx.cfg.enable_log_linecount = atoi(value); |
142 | else if (!strcmp(name, "enable-remote-branches")) | 144 | else if (!strcmp(name, "enable-remote-branches")) |
143 | ctx.cfg.enable_remote_branches = atoi(value); | 145 | ctx.cfg.enable_remote_branches = atoi(value); |
146 | else if (!strcmp(name, "enable-subject-links")) | ||
147 | ctx.cfg.enable_subject_links = atoi(value); | ||
144 | else if (!strcmp(name, "enable-tree-linenumbers")) | 148 | else if (!strcmp(name, "enable-tree-linenumbers")) |
145 | ctx.cfg.enable_tree_linenumbers = atoi(value); | 149 | ctx.cfg.enable_tree_linenumbers = atoi(value); |
146 | else if (!strcmp(name, "max-stats")) | 150 | else if (!strcmp(name, "max-stats")) |
@@ -148,7 +152,7 @@ void config_cb(const char *name, const char *value) | |||
148 | else if (!strcmp(name, "cache-size")) | 152 | else if (!strcmp(name, "cache-size")) |
149 | ctx.cfg.cache_size = atoi(value); | 153 | ctx.cfg.cache_size = atoi(value); |
150 | else if (!strcmp(name, "cache-root")) | 154 | else if (!strcmp(name, "cache-root")) |
151 | ctx.cfg.cache_root = xstrdup(value); | 155 | ctx.cfg.cache_root = xstrdup(expand_macros(value)); |
152 | else if (!strcmp(name, "cache-root-ttl")) | 156 | else if (!strcmp(name, "cache-root-ttl")) |
153 | ctx.cfg.cache_root_ttl = atoi(value); | 157 | ctx.cfg.cache_root_ttl = atoi(value); |
154 | else if (!strcmp(name, "cache-repo-ttl")) | 158 | else if (!strcmp(name, "cache-repo-ttl")) |
@@ -165,6 +169,8 @@ void config_cb(const char *name, const char *value) | |||
165 | ctx.cfg.commit_filter = new_filter(value, 0); | 169 | ctx.cfg.commit_filter = new_filter(value, 0); |
166 | else if (!strcmp(name, "embedded")) | 170 | else if (!strcmp(name, "embedded")) |
167 | ctx.cfg.embedded = atoi(value); | 171 | ctx.cfg.embedded = atoi(value); |
172 | else if (!strcmp(name, "max-atom-items")) | ||
173 | ctx.cfg.max_atom_items = atoi(value); | ||
168 | else if (!strcmp(name, "max-message-length")) | 174 | else if (!strcmp(name, "max-message-length")) |
169 | ctx.cfg.max_msg_len = atoi(value); | 175 | ctx.cfg.max_msg_len = atoi(value); |
170 | else if (!strcmp(name, "max-repodesc-length")) | 176 | else if (!strcmp(name, "max-repodesc-length")) |
@@ -177,9 +183,9 @@ void config_cb(const char *name, const char *value) | |||
177 | ctx.cfg.max_commit_count = atoi(value); | 183 | ctx.cfg.max_commit_count = atoi(value); |
178 | else if (!strcmp(name, "scan-path")) | 184 | else if (!strcmp(name, "scan-path")) |
179 | if (!ctx.cfg.nocache && ctx.cfg.cache_size) | 185 | if (!ctx.cfg.nocache && ctx.cfg.cache_size) |
180 | process_cached_repolist(value); | 186 | process_cached_repolist(expand_macros(value)); |
181 | else | 187 | else |
182 | scan_tree(value, repo_config); | 188 | scan_tree(expand_macros(value), repo_config); |
183 | else if (!strcmp(name, "source-filter")) | 189 | else if (!strcmp(name, "source-filter")) |
184 | ctx.cfg.source_filter = new_filter(value, 1); | 190 | ctx.cfg.source_filter = new_filter(value, 1); |
185 | else if (!strcmp(name, "summary-log")) | 191 | else if (!strcmp(name, "summary-log")) |
@@ -203,7 +209,7 @@ void config_cb(const char *name, const char *value) | |||
203 | else if (!prefixcmp(name, "mimetype.")) | 209 | else if (!prefixcmp(name, "mimetype.")) |
204 | add_mimetype(name + 9, value); | 210 | add_mimetype(name + 9, value); |
205 | else if (!strcmp(name, "include")) | 211 | else if (!strcmp(name, "include")) |
206 | parse_configfile(value, config_cb); | 212 | parse_configfile(expand_macros(value), config_cb); |
207 | } | 213 | } |
208 | 214 | ||
209 | static void querystring_cb(const char *name, const char *value) | 215 | static void querystring_cb(const char *name, const char *value) |
@@ -250,6 +256,8 @@ static void querystring_cb(const char *name, const char *value) | |||
250 | ctx.qry.period = xstrdup(value); | 256 | ctx.qry.period = xstrdup(value); |
251 | } else if (!strcmp(name, "ss")) { | 257 | } else if (!strcmp(name, "ss")) { |
252 | ctx.qry.ssdiff = atoi(value); | 258 | ctx.qry.ssdiff = atoi(value); |
259 | } else if (!strcmp(name, "all")) { | ||
260 | ctx.qry.show_all = atoi(value); | ||
253 | } else if (!strcmp(name, "context")) { | 261 | } else if (!strcmp(name, "context")) { |
254 | ctx.qry.context = atoi(value); | 262 | ctx.qry.context = atoi(value); |
255 | } else if (!strcmp(name, "ignorews")) { | 263 | } else if (!strcmp(name, "ignorews")) { |
@@ -296,6 +304,7 @@ static void prepare_context(struct cgit_context *ctx) | |||
296 | ctx->cfg.summary_branches = 10; | 304 | ctx->cfg.summary_branches = 10; |
297 | ctx->cfg.summary_log = 10; | 305 | ctx->cfg.summary_log = 10; |
298 | ctx->cfg.summary_tags = 10; | 306 | ctx->cfg.summary_tags = 10; |
307 | ctx->cfg.max_atom_items = 10; | ||
299 | ctx->cfg.ssdiff = 0; | 308 | ctx->cfg.ssdiff = 0; |
300 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); | 309 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); |
301 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); | 310 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); |
@@ -698,7 +707,7 @@ int main(int argc, const char **argv) | |||
698 | cgit_repolist.repos = NULL; | 707 | cgit_repolist.repos = NULL; |
699 | 708 | ||
700 | cgit_parse_args(argc, argv); | 709 | cgit_parse_args(argc, argv); |
701 | parse_configfile(ctx.env.cgit_config, config_cb); | 710 | parse_configfile(expand_macros(ctx.env.cgit_config), config_cb); |
702 | ctx.repo = NULL; | 711 | ctx.repo = NULL; |
703 | http_parse_querystring(ctx.qry.raw, querystring_cb); | 712 | http_parse_querystring(ctx.qry.raw, querystring_cb); |
704 | 713 | ||
@@ -531,7 +531,10 @@ a.deco { | |||
531 | border: solid 1px #770000; | 531 | border: solid 1px #770000; |
532 | } | 532 | } |
533 | 533 | ||
534 | div.commit-subject a { | 534 | div.commit-subject a.branch-deco, |
535 | div.commit-subject a.tag-deco, | ||
536 | div.commit-subject a.remote-deco, | ||
537 | div.commit-subject a.deco { | ||
535 | margin-left: 1em; | 538 | margin-left: 1em; |
536 | font-size: 75%; | 539 | font-size: 75%; |
537 | } | 540 | } |
@@ -73,6 +73,7 @@ struct cgit_repo { | |||
73 | int enable_log_filecount; | 73 | int enable_log_filecount; |
74 | int enable_log_linecount; | 74 | int enable_log_linecount; |
75 | int enable_remote_branches; | 75 | int enable_remote_branches; |
76 | int enable_subject_links; | ||
76 | int max_stats; | 77 | int max_stats; |
77 | time_t mtime; | 78 | time_t mtime; |
78 | struct cgit_filter *about_filter; | 79 | struct cgit_filter *about_filter; |
@@ -145,6 +146,7 @@ struct cgit_query { | |||
145 | char *sort; | 146 | char *sort; |
146 | int showmsg; | 147 | int showmsg; |
147 | int ssdiff; | 148 | int ssdiff; |
149 | int show_all; | ||
148 | int context; | 150 | int context; |
149 | int ignorews; | 151 | int ignorews; |
150 | char *vpath; | 152 | char *vpath; |
@@ -184,8 +186,10 @@ struct cgit_config { | |||
184 | int enable_log_filecount; | 186 | int enable_log_filecount; |
185 | int enable_log_linecount; | 187 | int enable_log_linecount; |
186 | int enable_remote_branches; | 188 | int enable_remote_branches; |
189 | int enable_subject_links; | ||
187 | int enable_tree_linenumbers; | 190 | int enable_tree_linenumbers; |
188 | int local_time; | 191 | int local_time; |
192 | int max_atom_items; | ||
189 | int max_repo_count; | 193 | int max_repo_count; |
190 | int max_commit_count; | 194 | int max_commit_count; |
191 | int max_lock_attempts; | 195 | int max_lock_attempts; |
@@ -300,4 +304,6 @@ extern int cgit_close_filter(struct cgit_filter *filter); | |||
300 | 304 | ||
301 | extern int readfile(const char *path, char **buf, size_t *size); | 305 | extern int readfile(const char *path, char **buf, size_t *size); |
302 | 306 | ||
307 | extern char *expand_macros(const char *txt); | ||
308 | |||
303 | #endif /* CGIT_H */ | 309 | #endif /* CGIT_H */ |
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 1f7ac1e..a853522 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
@@ -115,6 +115,12 @@ enable-remote-branches:: | |||
115 | in the summary and refs views. Default value: "0". See also: | 115 | in the summary and refs views. Default value: "0". See also: |
116 | "repo.enable-remote-branches". | 116 | "repo.enable-remote-branches". |
117 | 117 | ||
118 | enable-subject-links:: | ||
119 | Flag which, when set to "1", will make cgit use the subject of the | ||
120 | parent commit as link text when generating links to parent commits | ||
121 | in commit view. Default value: "0". See also: | ||
122 | "repo.enable-subject-links". | ||
123 | |||
118 | enable-tree-linenumbers:: | 124 | enable-tree-linenumbers:: |
119 | Flag which, when set to "1", will make cgit generate linenumber links | 125 | Flag which, when set to "1", will make cgit generate linenumber links |
120 | for plaintext blobs printed in the tree view. Default value: "1". | 126 | for plaintext blobs printed in the tree view. Default value: "1". |
@@ -166,6 +172,10 @@ logo-link:: | |||
166 | calculated url of the repository index page will be used. Default | 172 | calculated url of the repository index page will be used. Default |
167 | value: none. | 173 | value: none. |
168 | 174 | ||
175 | max-atom-items:: | ||
176 | Specifies the number of items to display in atom feeds view. Default | ||
177 | value: "10". | ||
178 | |||
169 | max-commit-count:: | 179 | max-commit-count:: |
170 | Specifies the number of entries to list per page in "log" view. Default | 180 | Specifies the number of entries to list per page in "log" view. Default |
171 | value: "50". | 181 | value: "50". |
@@ -321,6 +331,10 @@ repo.enable-remote-branches:: | |||
321 | Flag which, when set to "1", will make cgit display remote branches | 331 | Flag which, when set to "1", will make cgit display remote branches |
322 | in the summary and refs views. Default value: <enable-remote-branches>. | 332 | in the summary and refs views. Default value: <enable-remote-branches>. |
323 | 333 | ||
334 | repo.enable-subject-links:: | ||
335 | A flag which can be used to override the global setting | ||
336 | `enable-subject-links'. Default value: none. | ||
337 | |||
324 | repo.max-stats:: | 338 | repo.max-stats:: |
325 | Override the default maximum statistics period. Valid values are equal | 339 | Override the default maximum statistics period. Valid values are equal |
326 | to the values specified for the global "max-stats" setting. Default | 340 | to the values specified for the global "max-stats" setting. Default |
@@ -33,7 +33,7 @@ static void HEAD_fn(struct cgit_context *ctx) | |||
33 | 33 | ||
34 | static void atom_fn(struct cgit_context *ctx) | 34 | static void atom_fn(struct cgit_context *ctx) |
35 | { | 35 | { |
36 | cgit_print_atom(ctx->qry.head, ctx->qry.path, 10); | 36 | cgit_print_atom(ctx->qry.head, ctx->qry.path, ctx->cfg.max_atom_items); |
37 | } | 37 | } |
38 | 38 | ||
39 | static void about_fn(struct cgit_context *ctx) | 39 | static void about_fn(struct cgit_context *ctx) |
@@ -190,6 +190,10 @@ struct commitinfo *cgit_parse_commit(struct commit *commit) | |||
190 | ret->subject = xstrdup(p); | 190 | ret->subject = xstrdup(p); |
191 | 191 | ||
192 | if (ret->msg_encoding) { | 192 | if (ret->msg_encoding) { |
193 | reencode(&ret->author, PAGE_ENCODING, ret->msg_encoding); | ||
194 | reencode(&ret->author_email, PAGE_ENCODING, ret->msg_encoding); | ||
195 | reencode(&ret->committer, PAGE_ENCODING, ret->msg_encoding); | ||
196 | reencode(&ret->committer_email, PAGE_ENCODING, ret->msg_encoding); | ||
193 | reencode(&ret->subject, PAGE_ENCODING, ret->msg_encoding); | 197 | reencode(&ret->subject, PAGE_ENCODING, ret->msg_encoding); |
194 | reencode(&ret->msg, PAGE_ENCODING, ret->msg_encoding); | 198 | reencode(&ret->msg, PAGE_ENCODING, ret->msg_encoding); |
195 | } | 199 | } |
diff --git a/scan-tree.c b/scan-tree.c index dbca797..1e18f3c 100644 --- a/scan-tree.c +++ b/scan-tree.c | |||
@@ -56,6 +56,8 @@ static void add_repo(const char *base, const char *path, repo_config_fn fn) | |||
56 | path, strerror(errno), errno); | 56 | path, strerror(errno), errno); |
57 | return; | 57 | return; |
58 | } | 58 | } |
59 | if (!stat(fmt("%s/noweb", path), &st)) | ||
60 | return; | ||
59 | if ((pwd = getpwuid(st.st_uid)) == NULL) { | 61 | if ((pwd = getpwuid(st.st_uid)) == NULL) { |
60 | fprintf(stderr, "Error reading owner-info for %s: %s (%d)\n", | 62 | fprintf(stderr, "Error reading owner-info for %s: %s (%d)\n", |
61 | path, strerror(errno), errno); | 63 | path, strerror(errno), errno); |
@@ -59,6 +59,7 @@ struct cgit_repo *cgit_add_repo(const char *url) | |||
59 | ret->enable_log_filecount = ctx.cfg.enable_log_filecount; | 59 | ret->enable_log_filecount = ctx.cfg.enable_log_filecount; |
60 | ret->enable_log_linecount = ctx.cfg.enable_log_linecount; | 60 | ret->enable_log_linecount = ctx.cfg.enable_log_linecount; |
61 | ret->enable_remote_branches = ctx.cfg.enable_remote_branches; | 61 | ret->enable_remote_branches = ctx.cfg.enable_remote_branches; |
62 | ret->enable_subject_links = ctx.cfg.enable_subject_links; | ||
62 | ret->max_stats = ctx.cfg.max_stats; | 63 | ret->max_stats = ctx.cfg.max_stats; |
63 | ret->module_link = ctx.cfg.module_link; | 64 | ret->module_link = ctx.cfg.module_link; |
64 | ret->readme = NULL; | 65 | ret->readme = NULL; |
@@ -279,6 +280,10 @@ int cgit_diff_files(const unsigned char *old_sha1, | |||
279 | if ((file1.ptr && buffer_is_binary(file1.ptr, file1.size)) || | 280 | if ((file1.ptr && buffer_is_binary(file1.ptr, file1.size)) || |
280 | (file2.ptr && buffer_is_binary(file2.ptr, file2.size))) { |