-rw-r--r-- | cgit.c | 2 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | cgitrc.5.txt | 6 | ||||
-rw-r--r-- | ui-commit.c | 8 |
4 files changed, 17 insertions, 0 deletions
@@ -81,24 +81,26 @@ void config_cb(const char *name, const char *value) | |||
81 | else if (!strcmp(name, "cache-size")) | 81 | else if (!strcmp(name, "cache-size")) |
82 | ctx.cfg.cache_size = atoi(value); | 82 | ctx.cfg.cache_size = atoi(value); |
83 | else if (!strcmp(name, "cache-root")) | 83 | else if (!strcmp(name, "cache-root")) |
84 | ctx.cfg.cache_root = xstrdup(value); | 84 | ctx.cfg.cache_root = xstrdup(value); |
85 | else if (!strcmp(name, "cache-root-ttl")) | 85 | else if (!strcmp(name, "cache-root-ttl")) |
86 | ctx.cfg.cache_root_ttl = atoi(value); | 86 | ctx.cfg.cache_root_ttl = atoi(value); |
87 | else if (!strcmp(name, "cache-repo-ttl")) | 87 | else if (!strcmp(name, "cache-repo-ttl")) |
88 | ctx.cfg.cache_repo_ttl = atoi(value); | 88 | ctx.cfg.cache_repo_ttl = atoi(value); |
89 | else if (!strcmp(name, "cache-static-ttl")) | 89 | else if (!strcmp(name, "cache-static-ttl")) |
90 | ctx.cfg.cache_static_ttl = atoi(value); | 90 | ctx.cfg.cache_static_ttl = atoi(value); |
91 | else if (!strcmp(name, "cache-dynamic-ttl")) | 91 | else if (!strcmp(name, "cache-dynamic-ttl")) |
92 | ctx.cfg.cache_dynamic_ttl = atoi(value); | 92 | ctx.cfg.cache_dynamic_ttl = atoi(value); |
93 | else if (!strcmp(name, "commit-filter")) | ||
94 | ctx.cfg.commit_filter = new_filter(value, 0); | ||
93 | else if (!strcmp(name, "embedded")) | 95 | else if (!strcmp(name, "embedded")) |
94 | ctx.cfg.embedded = atoi(value); | 96 | ctx.cfg.embedded = atoi(value); |
95 | else if (!strcmp(name, "max-message-length")) | 97 | else if (!strcmp(name, "max-message-length")) |
96 | ctx.cfg.max_msg_len = atoi(value); | 98 | ctx.cfg.max_msg_len = atoi(value); |
97 | else if (!strcmp(name, "max-repodesc-length")) | 99 | else if (!strcmp(name, "max-repodesc-length")) |
98 | ctx.cfg.max_repodesc_len = atoi(value); | 100 | ctx.cfg.max_repodesc_len = atoi(value); |
99 | else if (!strcmp(name, "max-repo-count")) | 101 | else if (!strcmp(name, "max-repo-count")) |
100 | ctx.cfg.max_repo_count = atoi(value); | 102 | ctx.cfg.max_repo_count = atoi(value); |
101 | else if (!strcmp(name, "max-commit-count")) | 103 | else if (!strcmp(name, "max-commit-count")) |
102 | ctx.cfg.max_commit_count = atoi(value); | 104 | ctx.cfg.max_commit_count = atoi(value); |
103 | else if (!strcmp(name, "source-filter")) | 105 | else if (!strcmp(name, "source-filter")) |
104 | ctx.cfg.source_filter = new_filter(value, 1); | 106 | ctx.cfg.source_filter = new_filter(value, 1); |
@@ -174,24 +174,25 @@ struct cgit_config { | |||
174 | int max_commit_count; | 174 | int max_commit_count; |
175 | int max_lock_attempts; | 175 | int max_lock_attempts; |
176 | int max_msg_len; | 176 | int max_msg_len; |
177 | int max_repodesc_len; | 177 | int max_repodesc_len; |
178 | int max_stats; | 178 | int max_stats; |
179 | int nocache; | 179 | int nocache; |
180 | int noheader; | 180 | int noheader; |
181 | int renamelimit; | 181 | int renamelimit; |
182 | int snapshots; | 182 | int snapshots; |
183 | int summary_branches; | 183 | int summary_branches; |
184 | int summary_log; | 184 | int summary_log; |
185 | int summary_tags; | 185 | int summary_tags; |
186 | struct cgit_filter *commit_filter; | ||
186 | struct cgit_filter *source_filter; | 187 | struct cgit_filter *source_filter; |
187 | }; | 188 | }; |
188 | 189 | ||
189 | struct cgit_page { | 190 | struct cgit_page { |
190 | time_t modified; | 191 | time_t modified; |
191 | time_t expires; | 192 | time_t expires; |
192 | size_t size; | 193 | size_t size; |
193 | char *mimetype; | 194 | char *mimetype; |
194 | char *charset; | 195 | char *charset; |
195 | char *filename; | 196 | char *filename; |
196 | char *etag; | 197 | char *etag; |
197 | char *title; | 198 | char *title; |
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index d420ad4..2efd6aa 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
@@ -46,24 +46,30 @@ cache-size:: | |||
46 | 46 | ||
47 | cache-static-ttl:: | 47 | cache-static-ttl:: |
48 | Number which specifies the time-to-live, in minutes, for the cached | 48 | Number which specifies the time-to-live, in minutes, for the cached |
49 | version of repository pages accessed with a fixed SHA1. Default value: | 49 | version of repository pages accessed with a fixed SHA1. Default value: |
50 | "5". | 50 | "5". |
51 | 51 | ||
52 | clone-prefix:: | 52 | clone-prefix:: |
53 | Space-separated list of common prefixes which, when combined with a | 53 | Space-separated list of common prefixes which, when combined with a |
54 | repository url, generates valid clone urls for the repository. This | 54 | repository url, generates valid clone urls for the repository. This |
55 | setting is only used if `repo.clone-url` is unspecified. Default value: | 55 | setting is only used if `repo.clone-url` is unspecified. Default value: |
56 | none. | 56 | none. |
57 | 57 | ||
58 | commit-filter:: | ||
59 | Specifies a command which will be invoked to format commit messages. | ||
60 | The command will get the message on its STDIN, and the STDOUT from the | ||
61 | command will be included verbatim as the commit message, i.e. this can | ||
62 | be used to implement bugtracker integration. Default value: none. | ||
63 | |||
58 | css:: | 64 | css:: |
59 | Url which specifies the css document to include in all cgit pages. | 65 | Url which specifies the css document to include in all cgit pages. |
60 | Default value: "/cgit.css". | 66 | Default value: "/cgit.css". |
61 | 67 | ||
62 | embedded:: | 68 | embedded:: |
63 | Flag which, when set to "1", will make cgit generate a html fragment | 69 | Flag which, when set to "1", will make cgit generate a html fragment |
64 | suitable for embedding in other html pages. Default value: none. See | 70 | suitable for embedding in other html pages. Default value: none. See |
65 | also: "noheader". | 71 | also: "noheader". |
66 | 72 | ||
67 | enable-index-links:: | 73 | enable-index-links:: |
68 | Flag which, when set to "1", will make cgit generate extra links for | 74 | Flag which, when set to "1", will make cgit generate extra links for |
69 | each repo in the repository index (specifically, to the "summary", | 75 | each repo in the repository index (specifically, to the "summary", |
diff --git a/ui-commit.c b/ui-commit.c index 41ce70e..ee0e139 100644 --- a/ui-commit.c +++ b/ui-commit.c | |||
@@ -80,27 +80,35 @@ void cgit_print_commit(char *hex) | |||
80 | sha1_to_hex(p->item->object.sha1), NULL); | 80 | sha1_to_hex(p->item->object.sha1), NULL); |
81 | html(")</td></tr>"); | 81 | html(")</td></tr>"); |
82 | parents++; | 82 | parents++; |
83 | } | 83 | } |
84 | if (ctx.repo->snapshots) { | 84 | if (ctx.repo->snapshots) { |
85 | html("<tr><th>download</th><td colspan='2' class='sha1'>"); | 85 | html("<tr><th>download</th><td colspan='2' class='sha1'>"); |
86 | cgit_print_snapshot_links(ctx.qry.repo, ctx.qry.head, | 86 | cgit_print_snapshot_links(ctx.qry.repo, ctx.qry.head, |
87 | hex, ctx.repo->snapshots); | 87 | hex, ctx.repo->snapshots); |
88 | html("</td></tr>"); | 88 | html("</td></tr>"); |
89 | } | 89 | } |
90 | html("</table>\n"); | 90 | html("</table>\n"); |
91 | html("<div class='commit-subject'>"); | 91 | html("<div class='commit-subject'>"); |
92 | if (ctx.cfg.commit_filter) | ||
93 | cgit_open_filter(ctx.cfg.commit_filter); | ||
92 | html_txt(info->subject); | 94 | html_txt(info->subject); |
95 | if (ctx.cfg.commit_filter) | ||
96 | cgit_close_filter(ctx.cfg.commit_filter); | ||
93 | show_commit_decorations(commit); | 97 | show_commit_decorations(commit); |
94 | html("</div>"); | 98 | html("</div>"); |
95 | html("<div class='commit-msg'>"); | 99 | html("<div class='commit-msg'>"); |
100 | if (ctx.cfg.commit_filter) | ||
101 | cgit_open_filter(ctx.cfg.commit_filter); | ||
96 | html_txt(info->msg); | 102 | html_txt(info->msg); |
103 | if (ctx.cfg.commit_filter) | ||
104 | cgit_close_filter(ctx.cfg.commit_filter); | ||
97 | html("</div>"); | 105 | html("</div>"); |
98 | if (parents < 3) { | 106 | if (parents < 3) { |
99 | if (parents) | 107 | if (parents) |
100 | tmp = sha1_to_hex(commit->parents->item->object.sha1); | 108 | tmp = sha1_to_hex(commit->parents->item->object.sha1); |
101 | else | 109 | else |
102 | tmp = NULL; | 110 | tmp = NULL; |
103 | cgit_print_diff(ctx.qry.sha1, tmp, NULL); | 111 | cgit_print_diff(ctx.qry.sha1, tmp, NULL); |
104 | } | 112 | } |
105 | cgit_free_commitinfo(info); | 113 | cgit_free_commitinfo(info); |
106 | } | 114 | } |