diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | cgit.c | 41 | ||||
-rw-r--r-- | cgit.css | 24 | ||||
-rwxr-xr-x | tests/t0104-tree.sh | 2 | ||||
-rwxr-xr-x | tests/t0107-snapshot.sh | 2 | ||||
-rw-r--r-- | ui-log.c | 35 | ||||
-rw-r--r-- | ui-patch.c | 4 | ||||
-rw-r--r-- | ui-refs.c | 2 | ||||
-rw-r--r-- | ui-snapshot.c | 4 | ||||
-rw-r--r-- | ui-tree.c | 6 |
10 files changed, 93 insertions, 31 deletions
diff --git a/Makefile b/Makefile index 3c7ec07..036fcd7 100644 --- a/Makefile +++ b/Makefile | |||
@@ -128,8 +128,8 @@ cgit.o: VERSION | |||
128 | -include $(OBJECTS:.o=.d) | 128 | -include $(OBJECTS:.o=.d) |
129 | 129 | ||
130 | libgit: | 130 | libgit: |
131 | $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) libgit.a | 131 | $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 libgit.a |
132 | $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) xdiff/lib.a | 132 | $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 xdiff/lib.a |
133 | 133 | ||
134 | test: all | 134 | test: all |
135 | $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all | 135 | $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all |
diff --git a/cgit.c b/cgit.c index 166fbc6..d1cee58 100644 --- a/cgit.c +++ b/cgit.c | |||
@@ -439,28 +439,29 @@ int main(int argc, const char **argv) | |||
439 | ctx.repo = NULL; | 439 | ctx.repo = NULL; |
440 | http_parse_querystring(ctx.qry.raw, querystring_cb); | 440 | http_parse_querystring(ctx.qry.raw, querystring_cb); |
441 | 441 | ||
442 | /* If virtual-root isn't specified in cgitrc and no url | 442 | /* If virtual-root isn't specified in cgitrc, lets pretend |
443 | * parameter is specified on the querystring, lets pretend | 443 | * that virtual-root equals SCRIPT_NAME. |
444 | * that virtualroot equals SCRIPT_NAME and use PATH_INFO as | ||
445 | * url. This allows cgit to work with virtual urls without | ||
446 | * the need for rewriterules in the webserver (as long as | ||
447 | * PATH_INFO is included in the cache lookup key). | ||
448 | */ | 444 | */ |
449 | if (!ctx.cfg.virtual_root && !ctx.qry.url) { | 445 | if (!ctx.cfg.virtual_root) |
450 | ctx.cfg.virtual_root = ctx.cfg.script_name; | 446 | ctx.cfg.virtual_root = ctx.cfg.script_name; |
451 | path = getenv("PATH_INFO"); | 447 | |
452 | if (path) { | 448 | /* If no url parameter is specified on the querystring, lets |
453 | if (path[0] == '/') | 449 | * use PATH_INFO as url. This allows cgit to work with virtual |
454 | path++; | 450 | * urls without the need for rewriterules in the webserver (as |
455 | ctx.qry.url = xstrdup(path); | 451 | * long as PATH_INFO is included in the cache lookup key). |
456 | if (ctx.qry.raw) { | 452 | */ |
457 | qry = ctx.qry.raw; | 453 | path = getenv("PATH_INFO"); |
458 | ctx.qry.raw = xstrdup(fmt("%s?%s", path, qry)); | 454 | if (!ctx.qry.url && path) { |
459 | free(qry); | 455 | if (path[0] == '/') |
460 | } else | 456 | path++; |
461 | ctx.qry.raw = ctx.qry.url; | 457 | ctx.qry.url = xstrdup(path); |
462 | cgit_parse_url(ctx.qry.url); | 458 | if (ctx.qry.raw) { |
463 | } | 459 | qry = ctx.qry.raw; |
460 | ctx.qry.raw = xstrdup(fmt("%s?%s", path, qry)); | ||
461 | free(qry); | ||
462 | } else | ||
463 | ctx.qry.raw = ctx.qry.url; | ||
464 | cgit_parse_url(ctx.qry.url); | ||
464 | } | 465 | } |
465 | 466 | ||
466 | ttl = calc_ttl(); | 467 | ttl = calc_ttl(); |
diff --git a/cgit.css b/cgit.css index 7928c2f..f19446d 100644 --- a/cgit.css +++ b/cgit.css | |||
@@ -471,3 +471,27 @@ div.footer { | |||
471 | font-size: 80%; | 471 | font-size: 80%; |
472 | color: #ccc; | 472 | color: #ccc; |
473 | } | 473 | } |
474 | a.branch-deco { | ||
475 | margin: 0px 0.5em; | ||
476 | padding: 0px 0.25em; | ||
477 | background-color: #88ff88; | ||
478 | border: solid 1px #007700; | ||
479 | } | ||
480 | a.tag-deco { | ||
481 | margin: 0px 0.5em; | ||
482 | padding: 0px 0.25em; | ||
483 | background-color: #ffff88; | ||
484 | border: solid 1px #777700; | ||
485 | } | ||
486 | a.remote-deco { | ||
487 | margin: 0px 0.5em; | ||
488 | padding: 0px 0.25em; | ||
489 | background-color: #ccccff; | ||
490 | border: solid 1px #000077; | ||
491 | } | ||
492 | a.deco { | ||
493 | margin: 0px 0.5em; | ||
494 | padding: 0px 0.25em; | ||
495 | background-color: #ff8888; | ||
496 | border: solid 1px #770000; | ||
497 | } | ||
diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh index 0d62cc8..33f4eb0 100755 --- a/tests/t0104-tree.sh +++ b/tests/t0104-tree.sh | |||
@@ -15,7 +15,7 @@ run_test 'find line 1' ' | |||
15 | ' | 15 | ' |
16 | 16 | ||
17 | run_test 'no line 2' ' | 17 | run_test 'no line 2' ' |
18 | grep -e "<a id=.n2. name=.n2. href=.#n2.>2</a>" trash/tmp | 18 | ! grep -e "<a id=.n2. name=.n2. href=.#n2.>2</a>" trash/tmp |
19 | ' | 19 | ' |
20 | 20 | ||
21 | run_test 'generate foo+bar/tree' 'cgit_url "foo%2bbar/tree" >trash/tmp' | 21 | run_test 'generate foo+bar/tree' 'cgit_url "foo%2bbar/tree" >trash/tmp' |
diff --git a/tests/t0107-snapshot.sh b/tests/t0107-snapshot.sh index 5f1b862..8ab4912 100755 --- a/tests/t0107-snapshot.sh +++ b/tests/t0107-snapshot.sh | |||
@@ -10,7 +10,7 @@ run_test 'get foo/snapshot/master.tar.gz' ' | |||
10 | 10 | ||
11 | run_test 'check html headers' ' | 11 | run_test 'check html headers' ' |
12 | head -n 1 trash/tmp | | 12 | head -n 1 trash/tmp | |
13 | grep -e "Content-Type: application/x-tar" && | 13 | grep -e "Content-Type: application/x-gzip" && |
14 | 14 | ||
15 | head -n 2 trash/tmp | | 15 | head -n 2 trash/tmp | |
16 | grep -e "Content-Disposition: inline; filename=.master.tar.gz." | 16 | grep -e "Content-Disposition: inline; filename=.master.tar.gz." |
diff --git a/ui-log.c b/ui-log.c index 2f90778..c3757dd 100644 --- a/ui-log.c +++ b/ui-log.c | |||
@@ -31,6 +31,38 @@ void inspect_files(struct diff_filepair *pair) | |||
31 | cgit_diff_files(pair->one->sha1, pair->two->sha1, count_lines); | 31 | cgit_diff_files(pair->one->sha1, pair->two->sha1, count_lines); |
32 | } | 32 | } |
33 | 33 | ||
34 | void show_commit_decorations(struct commit *commit) | ||
35 | { | ||
36 | struct name_decoration *deco; | ||
37 | static char buf[1024]; | ||
38 | |||
39 | buf[sizeof(buf) - 1] = 0; | ||
40 | deco = lookup_decoration(&name_decoration, &commit->object); | ||
41 | while (deco) { | ||
42 | if (!prefixcmp(deco->name, "refs/heads/")) { | ||
43 | strncpy(buf, deco->name + 11, sizeof(buf) - 1); | ||
44 | cgit_log_link(buf, NULL, "branch-deco", buf, NULL, NULL, | ||
45 | 0, NULL, NULL, ctx.qry.showmsg); | ||
46 | } | ||
47 | else if (!prefixcmp(deco->name, "tag: refs/tags/")) { | ||
48 | strncpy(buf, deco->name + 15, sizeof(buf) - 1); | ||
49 | cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf); | ||
50 | } | ||
51 | else if (!prefixcmp(deco->name, "refs/remotes/")) { | ||
52 | strncpy(buf, deco->name + 13, sizeof(buf) - 1); | ||
53 | cgit_log_link(buf, NULL, "remote-deco", NULL, | ||
54 | sha1_to_hex(commit->object.sha1), NULL, | ||
55 | 0, NULL, NULL, ctx.qry.showmsg); | ||
56 | } | ||
57 | else { | ||
58 | strncpy(buf, deco->name, sizeof(buf) - 1); | ||
59 | cgit_commit_link(buf, NULL, "deco", ctx.qry.head, | ||
60 | sha1_to_hex(commit->object.sha1)); | ||
61 | } | ||
62 | deco = deco->next; | ||
63 | } | ||
64 | } | ||
65 | |||
34 | void print_commit(struct commit *commit) | 66 | void print_commit(struct commit *commit) |
35 | { | 67 | { |
36 | struct commitinfo *info; | 68 | struct commitinfo *info; |
@@ -49,6 +81,7 @@ void print_commit(struct commit *commit) | |||
49 | ctx.qry.showmsg ? " class='logsubject'" : ""); | 81 | ctx.qry.showmsg ? " class='logsubject'" : ""); |
50 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, | 82 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, |
51 | sha1_to_hex(commit->object.sha1)); | 83 | sha1_to_hex(commit->object.sha1)); |
84 | show_commit_decorations(commit); | ||
52 | html("</td><td>"); | 85 | html("</td><td>"); |
53 | html_txt(info->author); | 86 | html_txt(info->author); |
54 | if (ctx.repo->enable_log_filecount) { | 87 | if (ctx.repo->enable_log_filecount) { |
@@ -119,6 +152,8 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
119 | rev.verbose_header = 1; | 152 | rev.verbose_header = 1; |
120 | rev.show_root_diff = 0; | 153 | rev.show_root_diff = 0; |
121 | setup_revisions(argc, argv, &rev, NULL); | 154 | setup_revisions(argc, argv, &rev, NULL); |
155 | load_ref_decorations(); | ||
156 | rev.show_decorations = 1; | ||
122 | rev.grep_filter.regflags |= REG_ICASE; | 157 | rev.grep_filter.regflags |= REG_ICASE; |
123 | compile_grep_patterns(&rev.grep_filter); | 158 | compile_grep_patterns(&rev.grep_filter); |
124 | prepare_revision_walk(&rev); | 159 | prepare_revision_walk(&rev); |
diff --git a/ui-patch.c b/ui-patch.c index e60877d..1d77336 100644 --- a/ui-patch.c +++ b/ui-patch.c | |||
@@ -101,9 +101,9 @@ void cgit_print_patch(char *hex) | |||
101 | ctx.page.filename = patchname; | 101 | ctx.page.filename = patchname; |
102 | cgit_print_http_headers(&ctx); | 102 | cgit_print_http_headers(&ctx); |
103 | htmlf("From %s Mon Sep 17 00:00:00 2001\n", sha1_to_hex(sha1)); | 103 | htmlf("From %s Mon Sep 17 00:00:00 2001\n", sha1_to_hex(sha1)); |
104 | htmlf("From: %s%s\n", info->author, info->author_email); | 104 | htmlf("From: %s %s\n", info->author, info->author_email); |
105 | html("Date: "); | 105 | html("Date: "); |
106 | cgit_print_date(info->author_date, "%a, %d %b %Y %H:%M:%S %z%n", ctx.cfg.local_time); | 106 | cgit_print_date(info->author_date, "%a, %d %b %Y %H:%M:%S %z%n", ctx.cfg.local_time); |
107 | htmlf("Subject: %s\n\n", info->subject); | 107 | htmlf("Subject: %s\n\n", info->subject); |
108 | if (info->msg && *info->msg) { | 108 | if (info->msg && *info->msg) { |
109 | htmlf("%s", info->msg); | 109 | htmlf("%s", info->msg); |
diff --git a/ui-refs.c b/ui-refs.c index d61ee7c..c35e694 100644 --- a/ui-refs.c +++ b/ui-refs.c | |||
@@ -141,7 +141,7 @@ static int print_tag(struct refinfo *ref) | |||
141 | html("<tr><td>"); | 141 | html("<tr><td>"); |
142 | html_txt(name); | 142 | html_txt(name); |
143 | html("</td><td>"); | 143 | html("</td><td>"); |
144 | if (ctx.repo->snapshots && (tag->tagged->type == OBJ_COMMIT)) | 144 | if (ctx.repo->snapshots && (ref->object->type == OBJ_COMMIT)) |
145 | print_tag_downloads(ctx.repo, name); | 145 | print_tag_downloads(ctx.repo, name); |
146 | else | 146 | else |
147 | cgit_object_link(ref->object); | 147 | cgit_object_link(ref->object); |
diff --git a/ui-snapshot.c b/ui-snapshot.c index f98f5d7..f25613e 100644 --- a/ui-snapshot.c +++ b/ui-snapshot.c | |||
@@ -58,8 +58,8 @@ static int write_tar_bzip2_archive(struct archiver_args *args) | |||
58 | 58 | ||
59 | const struct cgit_snapshot_format cgit_snapshot_formats[] = { | 59 | const struct cgit_snapshot_format cgit_snapshot_formats[] = { |
60 | { ".zip", "application/x-zip", write_zip_archive, 0x1 }, | 60 | { ".zip", "application/x-zip", write_zip_archive, 0x1 }, |
61 | { ".tar.gz", "application/x-tar", write_tar_gzip_archive, 0x2 }, | 61 | { ".tar.gz", "application/x-gzip", write_tar_gzip_archive, 0x2 }, |
62 | { ".tar.bz2", "application/x-tar", write_tar_bzip2_archive, 0x4 }, | 62 | { ".tar.bz2", "application/x-bzip2", write_tar_bzip2_archive, 0x4 }, |
63 | { ".tar", "application/x-tar", write_tar_archive, 0x8 }, | 63 | { ".tar", "application/x-tar", write_tar_archive, 0x8 }, |
64 | {} | 64 | {} |
65 | }; | 65 | }; |
diff --git a/ui-tree.c b/ui-tree.c index 051db7c..9876c99 100644 --- a/ui-tree.c +++ b/ui-tree.c | |||
@@ -54,8 +54,10 @@ static void print_object(const unsigned char *sha1, char *path) | |||
54 | } | 54 | } |
55 | idx++; | 55 | idx++; |
56 | } | 56 | } |
57 | htmlf(linefmt, ++lineno); | 57 | if (start < idx) { |
58 | html_txt(buf + start); | 58 | htmlf(linefmt, ++lineno); |
59 | html_txt(buf + start); | ||
60 | } | ||
59 | html("</td></tr>\n"); | 61 | html("</td></tr>\n"); |
60 | html("</table>\n"); | 62 | html("</table>\n"); |
61 | } | 63 | } |