diff options
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | cgit.c | 42 | ||||
-rw-r--r-- | cgit.css | 358 | ||||
-rw-r--r-- | cgit.h | 8 | ||||
-rw-r--r-- | cgitrc.5.txt | 67 | ||||
-rw-r--r-- | cmd.c | 44 | ||||
-rw-r--r-- | cmd.h | 3 | ||||
-rwxr-xr-x | filters/commit-links.sh | 18 | ||||
-rwxr-xr-x | filters/syntax-highlighting.sh | 11 | ||||
-rw-r--r-- | html.c | 8 | ||||
-rw-r--r-- | html.h | 1 | ||||
-rw-r--r-- | shared.c | 29 | ||||
-rwxr-xr-x | tests/setup.sh | 1 | ||||
-rwxr-xr-x | tests/t0102-summary.sh | 6 | ||||
-rw-r--r-- | ui-commit.c | 10 | ||||
-rw-r--r-- | ui-diff.c | 81 | ||||
-rw-r--r-- | ui-diff.h | 4 | ||||
-rw-r--r-- | ui-log.c | 29 | ||||
-rw-r--r-- | ui-repolist.c | 15 | ||||
-rw-r--r-- | ui-stats.c | 51 | ||||
-rw-r--r-- | ui-summary.c | 2 |
21 files changed, 507 insertions, 287 deletions
@@ -198,9 +198,9 @@ install-pdf: doc-pdf | |||
198 | $(INSTALL) -m 0644 $(DOC_PDF) $(DESTDIR)$(pdfdir) | 198 | $(INSTALL) -m 0644 $(DOC_PDF) $(DESTDIR)$(pdfdir) |
199 | 199 | ||
200 | uninstall: | 200 | uninstall: |
201 | rm -f $(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME) | 201 | rm -f $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME) |
202 | rm -f $(CGIT_DATA_PATH)/cgit.css | 202 | rm -f $(DESTDIR)$(CGIT_DATA_PATH)/cgit.css |
203 | rm -f $(CGIT_DATA_PATH)/cgit.png | 203 | rm -f $(DESTDIR)$(CGIT_DATA_PATH)/cgit.png |
204 | 204 | ||
205 | uninstall-doc: uninstall-man uninstall-html uninstall-pdf | 205 | uninstall-doc: uninstall-man uninstall-html uninstall-pdf |
206 | 206 | ||
@@ -26,14 +26,27 @@ void add_mimetype(const char *name, const char *value) | |||
26 | item->util = xstrdup(value); | 26 | item->util = xstrdup(value); |
27 | } | 27 | } |
28 | 28 | ||
29 | struct cgit_filter *new_filter(const char *cmd, int extra_args) | 29 | struct cgit_filter *new_filter(const char *cmd, filter_type filtertype) |
30 | { | 30 | { |
31 | struct cgit_filter *f; | 31 | struct cgit_filter *f; |
32 | int args_size = 0; | 32 | int args_size = 0; |
33 | int extra_args; | ||
33 | 34 | ||
34 | if (!cmd || !cmd[0]) | 35 | if (!cmd || !cmd[0]) |
35 | return NULL; | 36 | return NULL; |
36 | 37 | ||
38 | switch (filtertype) { | ||
39 | case SOURCE: | ||
40 | extra_args = 1; | ||
41 | break; | ||
42 | |||
43 | case ABOUT: | ||
44 | case COMMIT: | ||
45 | default: | ||
46 | extra_args = 0; | ||
47 | break; | ||
48 | } | ||
49 | |||
37 | f = xmalloc(sizeof(struct cgit_filter)); | 50 | f = xmalloc(sizeof(struct cgit_filter)); |
38 | f->cmd = xstrdup(cmd); | 51 | f->cmd = xstrdup(cmd); |
39 | args_size = (2 + extra_args) * sizeof(char *); | 52 | args_size = (2 + extra_args) * sizeof(char *); |
@@ -83,11 +96,11 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value) | |||
83 | repo->logo_link = xstrdup(value); | 96 | repo->logo_link = xstrdup(value); |
84 | else if (ctx.cfg.enable_filter_overrides) { | 97 | else if (ctx.cfg.enable_filter_overrides) { |
85 | if (!strcmp(name, "about-filter")) | 98 | if (!strcmp(name, "about-filter")) |
86 | repo->about_filter = new_filter(value, 0); | 99 | repo->about_filter = new_filter(value, ABOUT); |
87 | else if (!strcmp(name, "commit-filter")) | 100 | else if (!strcmp(name, "commit-filter")) |
88 | repo->commit_filter = new_filter(value, 0); | 101 | repo->commit_filter = new_filter(value, COMMIT); |
89 | else if (!strcmp(name, "source-filter")) | 102 | else if (!strcmp(name, "source-filter")) |
90 | repo->source_filter = new_filter(value, 1); | 103 | repo->source_filter = new_filter(value, SOURCE); |
91 | } | 104 | } |
92 | } | 105 | } |
93 | 106 | ||
@@ -147,6 +160,8 @@ void config_cb(const char *name, const char *value) | |||
147 | ctx.cfg.enable_filter_overrides = atoi(value); | 160 | ctx.cfg.enable_filter_overrides = atoi(value); |
148 | else if (!strcmp(name, "enable-gitweb-owner")) | 161 | else if (!strcmp(name, "enable-gitweb-owner")) |
149 | ctx.cfg.enable_gitweb_owner = atoi(value); | 162 | ctx.cfg.enable_gitweb_owner = atoi(value); |
163 | else if (!strcmp(name, "enable-http-clone")) | ||
164 | ctx.cfg.enable_http_clone = atoi(value); | ||
150 | else if (!strcmp(name, "enable-index-links")) | 165 | else if (!strcmp(name, "enable-index-links")) |
151 | ctx.cfg.enable_index_links = atoi(value); | 166 | ctx.cfg.enable_index_links = atoi(value); |
152 | else if (!strcmp(name, "enable-commit-graph")) | 167 | else if (!strcmp(name, "enable-commit-graph")) |
@@ -178,9 +193,9 @@ void config_cb(const char *name, const char *value) | |||
178 | else if (!strcmp(name, "cache-dynamic-ttl")) | 193 | else if (!strcmp(name, "cache-dynamic-ttl")) |
179 | ctx.cfg.cache_dynamic_ttl = atoi(value); | 194 | ctx.cfg.cache_dynamic_ttl = atoi(value); |
180 | else if (!strcmp(name, "about-filter")) | 195 | else if (!strcmp(name, "about-filter")) |
181 | ctx.cfg.about_filter = new_filter(value, 0); | 196 | ctx.cfg.about_filter = new_filter(value, ABOUT); |
182 | else if (!strcmp(name, "commit-filter")) | 197 | else if (!strcmp(name, "commit-filter")) |
183 | ctx.cfg.commit_filter = new_filter(value, 0); | 198 | ctx.cfg.commit_filter = new_filter(value, COMMIT); |
184 | else if (!strcmp(name, "embedded")) | 199 | else if (!strcmp(name, "embedded")) |
185 | ctx.cfg.embedded = atoi(value); | 200 | ctx.cfg.embedded = atoi(value); |
186 | else if (!strcmp(name, "max-atom-items")) | 201 | else if (!strcmp(name, "max-atom-items")) |
@@ -210,7 +225,7 @@ void config_cb(const char *name, const char *value) | |||
210 | else if (!strcmp(name, "section-from-path")) | 225 | else if (!strcmp(name, "section-from-path")) |
211 | ctx.cfg.section_from_path = atoi(value); | 226 | ctx.cfg.section_from_path = atoi(value); |
212 | else if (!strcmp(name, "source-filter")) | 227 | else if (!strcmp(name, "source-filter")) |
213 | ctx.cfg.source_filter = new_filter(value, 1); | 228 | ctx.cfg.source_filter = new_filter(value, SOURCE); |
214 | else if (!strcmp(name, "summary-log")) | 229 | else if (!strcmp(name, "summary-log")) |
215 | ctx.cfg.summary_log = atoi(value); | 230 | ctx.cfg.summary_log = atoi(value); |
216 | else if (!strcmp(name, "summary-branches")) | 231 | else if (!strcmp(name, "summary-branches")) |
@@ -229,6 +244,8 @@ void config_cb(const char *name, const char *value) | |||
229 | ctx.cfg.robots = xstrdup(value); | 244 | ctx.cfg.robots = xstrdup(value); |
230 | else if (!strcmp(name, "clone-prefix")) | 245 | else if (!strcmp(name, "clone-prefix")) |
231 | ctx.cfg.clone_prefix = xstrdup(value); | 246 | ctx.cfg.clone_prefix = xstrdup(value); |
247 | else if (!strcmp(name, "clone-url")) | ||
248 | ctx.cfg.clone_url = xstrdup(value); | ||
232 | else if (!strcmp(name, "local-time")) | 249 | else if (!strcmp(name, "local-time")) |
233 | ctx.cfg.local_time = atoi(value); | 250 | ctx.cfg.local_time = atoi(value); |
234 | else if (!prefixcmp(name, "mimetype.")) | 251 | else if (!prefixcmp(name, "mimetype.")) |
@@ -313,6 +330,7 @@ static void prepare_context(struct cgit_context *ctx) | |||
313 | ctx->cfg.logo = "/cgit.png"; | 330 | ctx->cfg.logo = "/cgit.png"; |
314 | ctx->cfg.local_time = 0; | 331 | ctx->cfg.local_time = 0; |
315 | ctx->cfg.enable_gitweb_owner = 1; | 332 | ctx->cfg.enable_gitweb_owner = 1; |
333 | ctx->cfg.enable_http_clone = 1; | ||
316 | ctx->cfg.enable_tree_linenumbers = 1; | 334 | ctx->cfg.enable_tree_linenumbers = 1; |
317 | ctx->cfg.max_repo_count = 50; | 335 | ctx->cfg.max_repo_count = 50; |
318 | ctx->cfg.max_commit_count = 50; | 336 | ctx->cfg.max_commit_count = 50; |
@@ -444,7 +462,7 @@ static int prepare_repo_cmd(struct cgit_context *ctx) | |||
444 | tmp = xstrdup(ctx->qry.head); | 462 | tmp = xstrdup(ctx->qry.head); |
445 | ctx->qry.head = ctx->repo->defbranch; | 463 | ctx->qry.head = ctx->repo->defbranch; |
446 | ctx->page.status = 404; | 464 | ctx->page.status = 404; |
447 | ctx->page.statusmsg = "not found"; | 465 | ctx->page.statusmsg = "Not found"; |
448 | cgit_print_http_headers(ctx); | 466 | cgit_print_http_headers(ctx); |
449 | cgit_print_docstart(ctx); | 467 | cgit_print_docstart(ctx); |
450 | cgit_print_pageheader(ctx); | 468 | cgit_print_pageheader(ctx); |
@@ -452,6 +470,7 @@ static int prepare_repo_cmd(struct cgit_context *ctx) | |||
452 | cgit_print_docend(); | 470 | cgit_print_docend(); |
453 | return 1; | 471 | return 1; |
454 | } | 472 | } |
473 | cgit_prepare_repo_env(ctx->repo); | ||
455 | return 0; | 474 | return 0; |
456 | } | 475 | } |
457 | 476 | ||
@@ -463,6 +482,8 @@ static void process_request(void *cbdata) | |||
463 | cmd = cgit_get_cmd(ctx); | 482 | cmd = cgit_get_cmd(ctx); |
464 | if (!cmd) { | 483 | if (!cmd) { |
465 | ctx->page.title = "cgit error"; | 484 | ctx->page.title = "cgit error"; |
485 | ctx->page.status = 404; | ||
486 | ctx->page.statusmsg = "Not found"; | ||
466 | cgit_print_http_headers(ctx); | 487 | cgit_print_http_headers(ctx); |
467 | cgit_print_docstart(ctx); | 488 | cgit_print_docstart(ctx); |
468 | cgit_print_pageheader(ctx); | 489 | cgit_print_pageheader(ctx); |
@@ -471,6 +492,11 @@ static void process_request(void *cbdata) | |||
471 | return; | 492 | return; |
472 | } | 493 | } |
473 | 494 | ||
495 | if (!ctx->cfg.enable_http_clone && cmd->is_clone) { | ||
496 | html_status(404, "Not found", 0); | ||
497 | return; | ||
498 | } | ||
499 | |||
474 | /* If cmd->want_vpath is set, assume ctx->qry.path contains a "virtual" | 500 | /* If cmd->want_vpath is set, assume ctx->qry.path contains a "virtual" |
475 | * in-project path limit to be made available at ctx->qry.vpath. | 501 | * in-project path limit to be made available at ctx->qry.vpath. |
476 | * Otherwise, no path limit is in effect (ctx->qry.vpath = NULL). | 502 | * Otherwise, no path limit is in effect (ctx->qry.vpath = NULL). |
@@ -1,4 +1,4 @@ | |||
1 | body, table, form { | 1 | body, div#cgit table, div#cgit form { |
2 | padding: 0em; | 2 | padding: 0em; |
3 | margin: 0em; | 3 | margin: 0em; |
4 | } | 4 | } |
@@ -11,39 +11,40 @@ body { | |||
11 | padding: 4px; | 11 | padding: 4px; |
12 | } | 12 | } |
13 | 13 | ||
14 | a { | 14 | div#cgit a { |
15 | color: blue; | 15 | color: blue; |
16 | text-decoration: none; | 16 | text-decoration: none; |
17 | } | 17 | } |
18 | 18 | ||
19 | a:hover { | 19 | div#cgit a:hover { |
20 | text-decoration: underline; | 20 | text-decoration: underline; |
21 | } | 21 | } |
22 | 22 | ||
23 | table { | 23 | div#cgit table { |
24 | border-collapse: collapse; | 24 | border-collapse: collapse; |
25 | } | 25 | } |
26 | 26 | ||
27 | table#header { | 27 | div#cgit table#header { |
28 | width: 100%; | 28 | width: 100%; |
29 | margin-bottom: 1em; | 29 | margin-bottom: 1em; |
30 | } | 30 | } |
31 | 31 | ||
32 | table#header td.logo { | 32 | div#cgit table#header td.logo { |
33 | width: 96px; | 33 | width: 96px; |
34 | vertical-align: top; | ||
34 | } | 35 | } |
35 | 36 | ||
36 | table#header td.main { | 37 | div#cgit table#header td.main { |
37 | font-size: 250%; | 38 | font-size: 250%; |
38 | padding-left: 10px; | 39 | padding-left: 10px; |
39 | white-space: nowrap; | 40 | white-space: nowrap; |
40 | } | 41 | } |
41 | 42 | ||
42 | table#header td.main a { | 43 | div#cgit table#header td.main a { |
43 | color: #000; | 44 | color: #000; |
44 | } | 45 | } |
45 | 46 | ||
46 | table#header td.form { | 47 | div#cgit table#header td.form { |
47 | text-align: right; | 48 | text-align: right; |
48 | vertical-align: bottom; | 49 | vertical-align: bottom; |
49 | padding-right: 1em; | 50 | padding-right: 1em; |
@@ -51,19 +52,19 @@ table#header td.form { | |||
51 | white-space: nowrap; | 52 | white-space: nowrap; |
52 | } | 53 | } |
53 | 54 | ||
54 | table#header td.form form, | 55 | div#cgit table#header td.form form, |
55 | table#header td.form input, | 56 | div#cgit table#header td.form input, |
56 | table#header td.form select { | 57 | div#cgit table#header td.form select { |
57 | font-size: 90%; | 58 | font-size: 90%; |
58 | } | 59 | } |
59 | 60 | ||
60 | table#header td.sub { | 61 | div#cgit table#header td.sub { |
61 | color: #777; | 62 | color: #777; |
62 | border-top: solid 1px #ccc; | 63 | border-top: solid 1px #ccc; |
63 | padding-left: 10px; | 64 | padding-left: 10px; |
64 | } | 65 | } |
65 | 66 | ||
66 | table.tabs { | 67 | div#cgit table.tabs { |
67 | border-bottom: solid 3px #ccc; | 68 | border-bottom: solid 3px #ccc; |
68 | border-collapse: collapse; | 69 | border-collapse: collapse; |
69 | margin-top: 2em; | 70 | margin-top: 2em; |
@@ -71,74 +72,74 @@ table.tabs { | |||
71 | width: 100%; | 72 | width: 100%; |
72 | } | 73 | } |
73 | 74 | ||
74 | table.tabs td { | 75 | div#cgit table.tabs td { |
75 | padding: 0px 1em; | 76 | padding: 0px 1em; |
76 | vertical-align: bottom; | 77 | vertical-align: bottom; |
77 | } | 78 | } |
78 | 79 | ||
79 | table.tabs td a { | 80 | div#cgit table.tabs td a { |
80 | padding: 2px 0.75em; | 81 | padding: 2px 0.75em; |
81 | color: #777; | 82 | color: #777; |
82 | font-size: 110%; | 83 | font-size: 110%; |
83 | } | 84 | } |
84 | 85 | ||
85 | table.tabs td a.active { | 86 | div#cgit table.tabs td a.active { |
86 | color: #000; | 87 | color: #000; |
87 | background-color: #ccc; | 88 | background-color: #ccc; |
88 | } | 89 | } |
89 | 90 | ||
90 | table.tabs td.form { | 91 | div#cgit table.tabs td.form { |
91 | text-align: right; | 92 | text-align: right; |
92 | } | 93 | } |
93 | 94 | ||
94 | table.tabs td.form form { | 95 | div#cgit table.tabs td.form form { |
95 | padding-bottom: 2px; | 96 | padding-bottom: 2px; |
96 | font-size: 90%; | 97 | font-size: 90%; |
97 | white-space: nowrap; | 98 | white-space: nowrap; |
98 | } | 99 | } |
99 | 100 | ||
100 | table.tabs td.form input, | 101 | div#cgit table.tabs td.form input, |
101 | table.tabs td.form select { | 102 | div#cgit table.tabs td.form select { |
102 | font-size: 90%; | 103 | font-size: 90%; |
103 | } | 104 | } |
104 | 105 | ||
105 | div.path { | 106 | div#cgit div.path { |
106 | margin: 0px; | 107 | margin: 0px; |
107 | padding: 5px 2em 2px 2em; | 108 | padding: 5px 2em 2px 2em; |
108 | color: #000; | 109 | color: #000; |
109 | background-color: #eee; | 110 | background-color: #eee; |
110 | } | 111 | } |
111 | 112 | ||
112 | div.content { | 113 | div#cgit div.content { |
113 | margin: 0px; | 114 | margin: 0px; |
114 | padding: 2em; | 115 | padding: 2em; |
115 | border-bottom: solid 3px #ccc; | 116 | border-bottom: solid 3px #ccc; |
116 | } | 117 | } |
117 | 118 | ||
118 | 119 | ||
119 | table.list { | 120 | div#cgit table.list { |
120 | width: 100%; | 121 | width: 100%; |
121 | border: none; | 122 | border: none; |
122 | border-collapse: collapse; | 123 | border-collapse: collapse; |
123 | } | 124 | } |
124 | 125 | ||
125 | table.list tr { | 126 | div#cgit table.list tr { |
126 | background: white; | 127 | background: white; |
127 | } | 128 | } |
128 | 129 | ||
129 | table.list tr.logheader { | 130 | div#cgit table.list tr.logheader { |
130 | background: #eee; | 131 | background: #eee; |
131 | } | 132 | } |
132 | 133 | ||
133 | table.list tr:hover { | 134 | div#cgit table.list tr:hover { |
134 | background: #eee; | 135 | background: #eee; |
135 | } | 136 | } |
136 | 137 | ||
137 | table.list tr.nohover:hover { | 138 | div#cgit table.list tr.nohover:hover { |
138 | background: white; | 139 | background: white; |
139 | } | 140 | } |
140 | 141 | ||
141 | table.list th { | 142 | div#cgit table.list th { |
142 | font-weight: bold; | 143 | font-weight: bold; |
143 | /* color: #888; | 144 | /* color: #888; |
144 | border-top: dashed 1px #888; | 145 | border-top: dashed 1px #888; |
@@ -148,93 +149,93 @@ table.list th { | |||
148 | vertical-align: baseline; | 149 | vertical-align: baseline; |
149 | } | 150 | } |
150 | 151 | ||
151 | table.list td { | 152 | div#cgit table.list td { |
152 | border: none; | 153 | border: none; |
153 | padding: 0.1em 0.5em 0.1em 0.5em; | 154 | padding: 0.1em 0.5em 0.1em 0.5em; |
154 | } | 155 | } |
155 | 156 | ||
156 | table.list td.commitgraph { | 157 | div#cgit table.list td.commitgraph { |
157 | font-family: monospace; | 158 | font-family: monospace; |
158 | white-space: pre; | 159 | white-space: pre; |
159 | } | 160 | } |
160 | 161 | ||
161 | table.list td.commitgraph .column1 { | 162 | div#cgit table.list td.commitgraph .column1 { |
162 | color: #a00; | 163 | color: #a00; |
163 | } | 164 | } |
164 | 165 | ||
165 | table.list td.commitgraph .column2 { | 166 | div#cgit table.list td.commitgraph .column2 { |
166 | color: #0a0; | 167 | color: #0a0; |
167 | } | 168 | } |
168 | 169 | ||
169 | table.list td.commitgraph .column3 { | 170 | div#cgit table.list td.commitgraph .column3 { |
170 | color: #aa0; | 171 | color: #aa0; |
171 | } | 172 | } |
172 | 173 | ||
173 | table.list td.commitgraph .column4 { | 174 | div#cgit table.list td.commitgraph .column4 { |
174 | color: #00a; | 175 | color: #00a; |
175 | } | 176 | } |
176 | 177 | ||
177 | table.list td.commitgraph .column5 { | 178 | div#cgit table.list td.commitgraph .column5 { |
178 | color: #a0a; | 179 | color: #a0a; |
179 | } | 180 | } |
180 | 181 | ||
181 | table.list td.commitgraph .column6 { | 182 | div#cgit table.list td.commitgraph .column6 { |
182 | color: #0aa; | 183 | color: #0aa; |
183 | } | 184 | } |
184 | 185 | ||
185 | table.list td.logsubject { | 186 | div#cgit table.list td.logsubject { |
186 | font-family: monospace; | 187 | font-family: monospace; |
187 | font-weight: bold; | 188 | font-weight: bold; |
188 | } | 189 | } |
189 | 190 | ||
190 | table.list td.logmsg { | 191 | div#cgit table.list td.logmsg { |
191 | font-family: monospace; | 192 | font-family: monospace; |
192 | white-space: pre; | 193 | white-space: pre; |