| -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 | ||||
| -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-tree.c | 6 |
8 files changed, 28 insertions, 90 deletions
@@ -128,8 +128,8 @@ cgit.o: VERSION -include $(OBJECTS:.o=.d) libgit: - $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 libgit.a - $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 xdiff/lib.a + $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) libgit.a + $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) xdiff/lib.a test: all $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all @@ -439,29 +439,28 @@ int main(int argc, const char **argv) ctx.repo = NULL; http_parse_querystring(ctx.qry.raw, querystring_cb); - /* If virtual-root isn't specified in cgitrc, lets pretend - * that virtual-root equals SCRIPT_NAME. + /* If virtual-root isn't specified in cgitrc and no url + * parameter is specified on the querystring, lets pretend + * that virtualroot equals SCRIPT_NAME and use PATH_INFO as + * url. This allows cgit to work with virtual urls without + * the need for rewriterules in the webserver (as long as + * PATH_INFO is included in the cache lookup key). */ - if (!ctx.cfg.virtual_root) + if (!ctx.cfg.virtual_root && !ctx.qry.url) { ctx.cfg.virtual_root = ctx.cfg.script_name; - - /* If no url parameter is specified on the querystring, lets - * use PATH_INFO as url. This allows cgit to work with virtual - * urls without the need for rewriterules in the webserver (as - * long as PATH_INFO is included in the cache lookup key). - */ - path = getenv("PATH_INFO"); - if (!ctx.qry.url && path) { - if (path[0] == '/') - path++; - ctx.qry.url = xstrdup(path); - if (ctx.qry.raw) { - qry = ctx.qry.raw; - ctx.qry.raw = xstrdup(fmt("%s?%s", path, qry)); - free(qry); - } else - ctx.qry.raw = ctx.qry.url; - cgit_parse_url(ctx.qry.url); + path = getenv("PATH_INFO"); + if (path) { + if (path[0] == '/') + path++; + ctx.qry.url = xstrdup(path); + if (ctx.qry.raw) { + qry = ctx.qry.raw; + ctx.qry.raw = xstrdup(fmt("%s?%s", path, qry)); + free(qry); + } else + ctx.qry.raw = ctx.qry.url; + cgit_parse_url(ctx.qry.url); + } } ttl = calc_ttl(); @@ -471,27 +471,3 @@ div.footer { font-size: 80%; color: #ccc; } -a.branch-deco { - margin: 0px 0.5em; - padding: 0px 0.25em; - background-color: #88ff88; - border: solid 1px #007700; -} -a.tag-deco { - margin: 0px 0.5em; - padding: 0px 0.25em; - background-color: #ffff88; - border: solid 1px #777700; -} -a.remote-deco { - margin: 0px 0.5em; - padding: 0px 0.25em; - background-color: #ccccff; - border: solid 1px #000077; -} -a.deco { - margin: 0px 0.5em; - padding: 0px 0.25em; - background-color: #ff8888; - border: solid 1px #770000; -} diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh index 33f4eb0..0d62cc8 100755 --- a/tests/t0104-tree.sh +++ b/tests/t0104-tree.sh @@ -15,7 +15,7 @@ run_test 'find line 1' ' ' run_test 'no line 2' ' - ! grep -e "<a id=.n2. name=.n2. href=.#n2.>2</a>" trash/tmp + grep -e "<a id=.n2. name=.n2. href=.#n2.>2</a>" trash/tmp ' run_test 'generate foo+bar/tree' 'cgit_url "foo%2bbar/tree" >trash/tmp' @@ -31,38 +31,6 @@ void inspect_files(struct diff_filepair *pair) cgit_diff_files(pair->one->sha1, pair->two->sha1, count_lines); } -void show_commit_decorations(struct commit *commit) -{ - struct name_decoration *deco; - static char buf[1024]; - - buf[sizeof(buf) - 1] = 0; - deco = lookup_decoration(&name_decoration, &commit->object); - while (deco) { - if (!prefixcmp(deco->name, "refs/heads/")) { - strncpy(buf, deco->name + 11, sizeof(buf) - 1); - cgit_log_link(buf, NULL, "branch-deco", buf, NULL, NULL, - 0, NULL, NULL, ctx.qry.showmsg); - } - else if (!prefixcmp(deco->name, "tag: refs/tags/")) { - strncpy(buf, deco->name + 15, sizeof(buf) - 1); - cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf); - } - else if (!prefixcmp(deco->name, "refs/remotes/")) { - strncpy(buf, deco->name + 13, sizeof(buf) - 1); - cgit_log_link(buf, NULL, "remote-deco", NULL, - sha1_to_hex(commit->object.sha1), NULL, - 0, NULL, NULL, ctx.qry.showmsg); - } - else { - strncpy(buf, deco->name, sizeof(buf) - 1); - cgit_commit_link(buf, NULL, "deco", ctx.qry.head, - sha1_to_hex(commit->object.sha1)); - } - deco = deco->next; - } -} - void print_commit(struct commit *commit) { struct commitinfo *info; @@ -81,7 +49,6 @@ void print_commit(struct commit *commit) ctx.qry.showmsg ? " class='logsubject'" : ""); cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, sha1_to_hex(commit->object.sha1)); - show_commit_decorations(commit); html("</td><td>"); html_txt(info->author); if (ctx.repo->enable_log_filecount) { @@ -152,8 +119,6 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern rev.verbose_header = 1; rev.show_root_diff = 0; setup_revisions(argc, argv, &rev, NULL); - load_ref_decorations(); - rev.show_decorations = 1; rev.grep_filter.regflags |= REG_ICASE; compile_grep_patterns(&rev.grep_filter); prepare_revision_walk(&rev); @@ -101,9 +101,9 @@ void cgit_print_patch(char *hex) ctx.page.filename = patchname; cgit_print_http_headers(&ctx); htmlf("From %s Mon Sep 17 00:00:00 2001\n", sha1_to_hex(sha1)); - htmlf("From: %s %s\n", info->author, info->author_email); + htmlf("From: %s%s\n", info->author, info->author_email); html("Date: "); - cgit_print_date(info->author_date, "%a, %d %b %Y %H:%M:%S %z%n", ctx.cfg.local_time); + cgit_print_date(info->author_date, "%a, %d %b %Y %H:%M:%S %z%n", ctx.cfg.local_time); htmlf("Subject: %s\n\n", info->subject); if (info->msg && *info->msg) { htmlf("%s", info->msg); @@ -141,7 +141,7 @@ static int print_tag(struct refinfo *ref) html("<tr><td>"); html_txt(name); html("</td><td>"); - if (ctx.repo->snapshots && (ref->object->type == OBJ_COMMIT)) + if (ctx.repo->snapshots && (tag->tagged->type == OBJ_COMMIT)) print_tag_downloads(ctx.repo, name); else cgit_object_link(ref->object); @@ -54,10 +54,8 @@ static void print_object(const unsigned char *sha1, char *path) } idx++; } - if (start < idx) { - htmlf(linefmt, ++lineno); - html_txt(buf + start); - } + htmlf(linefmt, ++lineno); + html_txt(buf + start); html("</td></tr>\n"); html("</table>\n"); } |