aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--cgit.c25
-rw-r--r--cgit.css347
-rw-r--r--cgit.h2
-rw-r--r--cgitrc.5.txt13
-rwxr-xr-xfilters/syntax-highlighting.sh28
-rw-r--r--html.c4
-rw-r--r--parsing.c2
-rw-r--r--shared.c5
-rwxr-xr-xtests/setup.sh5
-rwxr-xr-xtests/t0108-patch.sh2
-rw-r--r--ui-diff.c17
-rw-r--r--ui-log.c3
-rw-r--r--ui-plain.c9
-rw-r--r--ui-repolist.c9
-rw-r--r--ui-shared.c86
-rw-r--r--ui-shared.h5
-rw-r--r--ui-ssdiff.c29
-rw-r--r--ui-ssdiff.h12
-rw-r--r--ui-tree.c13
20 files changed, 393 insertions, 227 deletions
diff --git a/Makefile b/Makefile
index 538a9f8..eac24ad 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
1CGIT_VERSION = v0.9.0.1 1CGIT_VERSION = v0.9.0.3
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)
@@ -13,7 +13,7 @@ pdfdir = $(docdir)
13mandir = $(prefix)/share/man 13mandir = $(prefix)/share/man
14SHA1_HEADER = <openssl/sha.h> 14SHA1_HEADER = <openssl/sha.h>
15GIT_VER = 1.7.4 15GIT_VER = 1.7.4
16GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2 16GIT_URL = http://hjemli.net/git/git/snapshot/git-$(GIT_VER).tar.bz2
17INSTALL = install 17INSTALL = install
18MAN5_TXT = $(wildcard *.5.txt) 18MAN5_TXT = $(wildcard *.5.txt)
19MAN_TXT = $(MAN5_TXT) 19MAN_TXT = $(MAN5_TXT)
diff --git a/cgit.c b/cgit.c
index abb698b..b9b3a66 100644
--- a/cgit.c
+++ b/cgit.c
@@ -60,6 +60,8 @@ static void process_cached_repolist(const char *path);
60 60
61void repo_config(struct cgit_repo *repo, const char *name, const char *value) 61void repo_config(struct cgit_repo *repo, const char *name, const char *value)
62{ 62{
63 struct string_list_item *item;
64
63 if (!strcmp(name, "name")) 65 if (!strcmp(name, "name"))
64 repo->name = xstrdup(value); 66 repo->name = xstrdup(value);
65 else if (!strcmp(name, "clone-url")) 67 else if (!strcmp(name, "clone-url"))
@@ -86,7 +88,10 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value)
86 repo->max_stats = cgit_find_stats_period(value, NULL); 88 repo->max_stats = cgit_find_stats_period(value, NULL);
87 else if (!strcmp(name, "module-link")) 89 else if (!strcmp(name, "module-link"))
88 repo->module_link= xstrdup(value); 90 repo->module_link= xstrdup(value);
89 else if (!strcmp(name, "section")) 91 else if (!prefixcmp(name, "module-link.")) {
92 item = string_list_append(&repo->submodules, name + 12);
93 item->util = xstrdup(value);
94 } else if (!strcmp(name, "section"))
90 repo->section = xstrdup(value); 95 repo->section = xstrdup(value);
91 else if (!strcmp(name, "readme") && value != NULL) 96 else if (!strcmp(name, "readme") && value != NULL)
92 repo->readme = xstrdup(value); 97 repo->readme = xstrdup(value);
@@ -300,6 +305,7 @@ static void querystring_cb(const char *name, const char *value)
300 ctx.qry.period = xstrdup(value); 305 ctx.qry.period = xstrdup(value);
301 } else if (!strcmp(name, "ss")) { 306 } else if (!strcmp(name, "ss")) {
302 ctx.qry.ssdiff = atoi(value); 307 ctx.qry.ssdiff = atoi(value);
308 ctx.qry.has_ssdiff = 1;
303 } else if (!strcmp(name, "all")) { 309 } else if (!strcmp(name, "all")) {
304 ctx.qry.show_all = atoi(value); 310 ctx.qry.show_all = atoi(value);
305 } else if (!strcmp(name, "context")) { 311 } else if (!strcmp(name, "context")) {
@@ -340,7 +346,6 @@ static void prepare_context(struct cgit_context *ctx)
340 ctx->cfg.max_repodesc_len = 80; 346 ctx->cfg.max_repodesc_len = 80;
341 ctx->cfg.max_blob_size = 0; 347 ctx->cfg.max_blob_size = 0;
342 ctx->cfg.max_stats = 0; 348 ctx->cfg.max_stats = 0;
343 ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s";
344 ctx->cfg.project_list = NULL; 349 ctx->cfg.project_list = NULL;
345 ctx->cfg.renamelimit = -1; 350 ctx->cfg.renamelimit = -1;
346 ctx->cfg.remove_suffix = 0; 351 ctx->cfg.remove_suffix = 0;
@@ -418,6 +423,17 @@ char *find_default_branch(struct cgit_repo *repo)
418 return ref; 423 return ref;
419} 424}
420 425
426static char *guess_defbranch(const char *repo_path)
427{
428 const char *ref;
429 unsigned char sha1[20];
430
431 ref = resolve_ref("HEAD", sha1, 0, NULL);
432 if (!ref || prefixcmp(ref, "refs/heads/"))
433 return "master";
434 return xstrdup(ref + 11);
435}
436
421static int prepare_repo_cmd(struct cgit_context *ctx) 437static int prepare_repo_cmd(struct cgit_context *ctx)
422{ 438{
423 char *tmp; 439 char *tmp;
@@ -444,10 +460,12 @@ static int prepare_repo_cmd(struct cgit_context *ctx)
444 } 460 }
445 ctx->page.title = fmt("%s - %s", ctx->repo->name, ctx->repo->desc); 461 ctx->page.title = fmt("%s - %s", ctx->repo->name, ctx->repo->desc);
446 462
463 if (!ctx->repo->defbranch)
464 ctx->repo->defbranch = guess_defbranch(ctx->repo->path);
465
447 if (!ctx->qry.head) { 466 if (!ctx->qry.head) {
448 ctx->qry.nohead = 1; 467 ctx->qry.nohead = 1;
449 ctx->qry.head = find_default_branch(ctx->repo); 468 ctx->qry.head = find_default_branch(ctx->repo);
450 ctx->repo->defbranch = ctx->qry.head;
451 } 469 }
452 470
453 if (!ctx->qry.head) { 471 if (!ctx->qry.head) {
@@ -471,6 +489,7 @@ static int prepare_repo_cmd(struct cgit_context *ctx)
471 cgit_print_docend(); 489 cgit_print_docend();
472 return 1; 490 return 1;
473 } 491 }
492 sort_string_list(&ctx->repo->submodules);
474 cgit_prepare_repo_env(ctx->repo); 493 cgit_prepare_repo_env(ctx->repo);
475 return 0; 494 return 0;
476} 495}
diff --git a/cgit.css b/cgit.css
index 55afa94..e06c261 100644
--- a/cgit.css
+++ b/cgit.css
@@ -1,4 +1,4 @@
1body, table, form { 1body, 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
14a { 14div#cgit a {
15 color: blue; 15 color: blue;
16 text-decoration: none; 16 text-decoration: none;
17} 17}
18 18
19a:hover { 19div#cgit a:hover {
20 text-decoration: underline; 20 text-decoration: underline;
21} 21}
22 22
23table { 23div#cgit table {
24 border-collapse: collapse; 24 border-collapse: collapse;
25} 25}
26 26
27table#header { 27div#cgit table#header {
28 width: 100%; 28 width: 100%;
29 margin-bottom: 1em; 29 margin-bottom: 1em;
30} 30}
31 31
32table#header td.logo { 32div#cgit table#header td.logo {
33 width: 96px; 33 width: 96px;
34 vertical-align: top;
34} 35}
35 36
36table#header td.main { 37div#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
42table#header td.main a { 43div#cgit table#header td.main a {
43 color: #000; 44 color: #000;
44} 45}
45 46
46table#header td.form { 47div#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
54table#header td.form form, 55div#cgit table#header td.form form,
55table#header td.form input, 56div#cgit table#header td.form input,
56table#header td.form select { 57div#cgit table#header td.form select {
57 font-size: 90%; 58 font-size: 90%;
58} 59}
59 60
60table#header td.sub { 61div#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
66table.tabs { 67div#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
74table.tabs td { 75div#cgit table.tabs td {
75 padding: 0px 1em; 76 padding: 0px 1em;
76 vertical-align: bottom; 77 vertical-align: bottom;
77} 78}
78 79
79table.tabs td a { 80div#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
85table.tabs td a.active { 86div#cgit table.tabs td a.active {
86 color: #000; 87 color: #000;
87 background-color: #ccc; 88 background-color: #ccc;
88} 89}
89 90
90table.tabs td.form { 91div#cgit table.tabs td.form {
91 text-align: right; 92 text-align: right;
92} 93}
93 94
94table.tabs td.form form { 95div#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
100table.tabs td.form input, 101div#cgit table.tabs td.form input,
101table.tabs td.form select { 102div#cgit table.tabs td.form select {
102 font-size: 90%; 103 font-size: 90%;
103} 104}
104 105
105div.path { 106div#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
112div.content { 113div#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
119table.list { 120div#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
125table.list tr { 126div#cgit table.list tr {
126 background: white; 127 background: white;
127} 128}
128 129
129table.list tr.logheader { 130div#cgit table.list tr.logheader {
130 background: #eee; 131 background: #eee;
131} 132}
132 133
133table.list tr:hover { 134div#cgit table.list tr:hover {
134 background: #eee; 135 background: #eee;
135} 136}
136 137
137table.list tr.nohover:hover { 138div#cgit table.list tr.nohover:hover {
138 background: white; 139 background: white;
139} 140}
140 141
141table.list th { 142div#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
151table.list td { 152div#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
156table.list td.commitgraph { 157div#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
161table.list td.commitgraph .column1 { 162div#cgit table.list td.commitgraph .column1 {
162 color: #a00; 163 color: #a00;
163} 164}
164 165
165table.list td.commitgraph .column2 { 166div#cgit table.list td.commitgraph .column2 {
166 color: #0a0; 167 color: #0a0;
167} 168}
168 169
169table.list td.commitgraph .column3 { 170div#cgit table.list td.commitgraph .column3 {
170 color: #aa0; 171 color: #aa0;
171} 172}
172 173
173table.list td.commitgraph .column4 { 174div#cgit table.list td.commitgraph .column4 {
174 color: #00a; 175 color: #00a;
175} 176}
176 177
177table.list td.commitgraph .column5 { 178div#cgit table.list td.commitgraph .column5 {
178 color: #a0a; 179 color: #a0a;
179} 180}
180 181
181table.list td.commitgraph .column6 { 182div#cgit table.list td.commitgraph .column6 {
182 color: #0aa; 183 color: #0aa;
183} 184}
184 185
185table.list td.logsubject { 186div#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
190table.list td.logmsg { 191div#cgit table.list td.logmsg {
191 font-family: monospace; 192 font-family: monospace;
192 white-space: pre; 193 white-space: pre;
193 padding: 0 0.5em; 194 padding: 0 0.5em;
194} 195}
195 196
196table.list td a { 197div#cgit table.list td a {
197 color: black; 198 color: black;
198} 199}
199 200
200table.list td a.ls-dir { 201div#cgit table.list td a.ls-dir {
201 font-weight: bold; 202 font-weight: bold;
202 color: #00f; 203 color: #00f;
203} 204}
204 205
205table.list td a:hover { 206div#cgit table.list td a:hover {
206 color: #00f; 207 color: #00f;
207} 208}
208 209
209img { 210div#cgit img {
210 border: none; 211 border: none;
211} 212}
212 213
213input#switch-btn { 214div#cgit input#switch-btn {
214 margin: 2px 0px 0px 0px; 215 margin: 2px 0px 0px 0px;
215} 216}
216 217
217td#sidebar input.txt { 218div#cgit td#sidebar input.txt {
218 width: 100%; 219 width: 100%;
219 margin: 2px 0px 0px 0px; 220 margin: 2px 0px 0px 0px;
220} 221}
221 222
222table#grid { 223div#cgit table#grid {
223 margin: 0px; 224 margin: 0px;
224} 225}
225 226
226td#content { 227div#cgit td#content {
227 vertical-align: top; 228 vertical-align: top;
228 padding: 1em 2em 1em 1em; 229 padding: 1em 2em 1em 1em;
229 border: none; 230 border: none;
230} 231}
231 232
232div#summary { 233div#cgit div#summary {
233 vertical-align: top; 234 vertical-align: top;
234 margin-bottom: 1em; 235 margin-bottom: 1em;
235} 236}
236 237
237table#downloads { 238div#cgit table#downloads {
238 float: right; 239 float: right;
239 border-collapse: collapse; 240 border-collapse: collapse;
240 border: solid 1px #777; 241 border: solid 1px #777;
@@ -242,152 +243,152 @@ table#downloads {
242 margin-bottom: 0.5em; 243 margin-bottom: 0.5em;
243} 244}
244 245
245table#downloads th { 246div#cgit table#downloads th {
246 background-color: #ccc; 247 background-color: #ccc;
247} 248}
248 249
249div#blob { 250div#cgit div#blob {
250 border: solid 1px black; 251 border: solid 1px black;
251} 252}
252 253
253div.error { 254div#cgit div.error {
254 color: red; 255 color: red;
255 font-weight: bold; 256 font-weight: bold;
256 margin: 1em 2em; 257 margin: 1em 2em;
257} 258}
258 259
259a.ls-blob, a.ls-dir, a.ls-mod { 260div#cgit a.ls-blob, div#cgit a.ls-dir, div#cgit a.ls-mod {
260 font-family: monospace; 261 font-family: monospace;
261} 262}
262 263
263td.ls-size { 264div#cgit td.ls-size {
264 text-align: right; 265 text-align: right;
265 font-family: monospace; 266 font-family: monospace;
266 width: 10em; 267 width: 10em;
267} 268}
268 269
269td.ls-mode { 270div#cgit td.ls-mode {
270 font-family: monospace; 271 font-family: monospace;
271 width: 10em; 272 width: 10em;
272} 273}
273 274
274table.blob { 275div#cgit table.blob {
275 margin-top: 0.5em; 276 margin-top: 0.5em;
276 border-top: solid 1px black; 277 border-top: solid 1px black;
277} 278}
278 279
279table.blob td.lines { 280div#cgit table.blob td.lines {
280 margin: 0; padding: 0 0 0 0.5em; 281 margin: 0; padding: 0 0 0 0.5em;
281 vertical-align: top; 282 vertical-align: top;
282 color: black; 283 color: black;
283} 284}
284 285
285table.blob td.linenumbers { 286div#cgit table.blob td.linenumbers {
286 margin: 0; padding: 0 0.5em 0 0.5em; 287 margin: 0; padding: 0 0.5em 0 0.5em;
287 vertical-align: top; 288 vertical-align: top;
288 text-align: right; 289 text-align: right;
289 border-right: 1px solid gray; 290 border-right: 1px solid gray;
290} 291}
291 292
292table.blob pre { 293div#cgit table.blob pre {
293 padding: 0; margin: 0; 294 padding: 0; margin: 0;
294} 295}
295 296
296table.blob a.no, table.ssdiff a.no { 297div#cgit table.blob a.no, div#cgit table.ssdiff a.no {
297 color: gray; 298 color: gray;
298 text-align: right; 299 text-align: right;
299 text-decoration: none; 300 text-decoration: none;
300} 301}
301 302
302table.blob a.no a:hover { 303div#cgit table.blob a.no a:hover {
303 color: black; 304 color: black;
304} 305}
305 306
306table.bin-blob { 307div#cgit table.bin-blob {
307 margin-top: 0.5em; 308 margin-top: 0.5em;
308 border: solid 1px black; 309 border: solid 1px black;
309} 310}
310 311
311table.bin-blob th { 312div#cgit table.bin-blob th {
312 font-family: monospace; 313 font-family: monospace;
313 white-space: pre; 314 white-space: pre;
314 border: solid 1px #777; 315 border: solid 1px #777;
315 padding: 0.5em 1em; 316 padding: 0.5em 1em;
316} 317}
317 318
318table.bin-blob td { 319div#cgit table.bin-blob td {
319 font-family: monospace; 320 font-family: monospace;
320 white-space: pre; 321 white-space: pre;
321 border-left: solid 1px #777; 322 border-left: solid 1px #777;
322 padding: 0em 1em; 323 padding: 0em 1em;
323} 324}
324 325
325table.nowrap td { 326div#cgit table.nowrap td {
326 white-space: nowrap; 327 white-space: nowrap;
327} 328}
328 329
329table.commit-info { 330div#cgit table.commit-info {
330 border-collapse: collapse; 331 border-collapse: collapse;
331 margin-top: 1.5em; 332 margin-top: 1.5em;
332} 333}
333 334