diff options
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | cgit.css | 24 | ||||
m--------- | git | 0 | ||||
-rw-r--r-- | shared.c | 4 | ||||
-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 |
9 files changed, 73 insertions, 10 deletions
@@ -4,7 +4,7 @@ CGIT_SCRIPT_PATH = /var/www/htdocs/cgit CGIT_CONFIG = /etc/cgitrc CACHE_ROOT = /var/cache/cgit SHA1_HEADER = <openssl/sha.h> -GIT_VER = 1.6.0.3 +GIT_VER = 1.6.1 GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2 # Define NO_STRCASESTR if you don't have strcasestr. @@ -128,8 +128,8 @@ cgit.o: VERSION -include $(OBJECTS:.o=.d) libgit: - $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) libgit.a - $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) xdiff/lib.a + $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 libgit.a + $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 xdiff/lib.a test: all $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all @@ -471,3 +471,27 @@ 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/git b/git -Subproject 031e6c898f61db1ae0c0be641eac6532c1000d5 +Subproject 8104ebfe8276657ee803cca7eb8665a78cf3ef8 @@ -267,10 +267,12 @@ int cgit_diff_files(const unsigned char *old_sha1, if (!load_mmfile(&file1, old_sha1) || !load_mmfile(&file2, new_sha1)) return 1; + memset(&diff_params, 0, sizeof(diff_params)); + memset(&emit_params, 0, sizeof(emit_params)); + memset(&emit_cb, 0, sizeof(emit_cb)); diff_params.flags = XDF_NEED_MINIMAL; emit_params.ctxlen = 3; emit_params.flags = XDL_EMIT_FUNCNAMES; - emit_params.find_func = NULL; emit_cb.outf = filediff_cb; emit_cb.priv = fn; xdl_diff(&file1, &file2, &diff_params, &emit_params, &emit_cb); 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' ' ' 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,6 +31,38 @@ 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; @@ -49,6 +81,7 @@ 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) { @@ -119,6 +152,8 @@ 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 && (tag->tagged->type == OBJ_COMMIT)) + if (ctx.repo->snapshots && (ref->object->type == OBJ_COMMIT)) print_tag_downloads(ctx.repo, name); else cgit_object_link(ref->object); @@ -54,8 +54,10 @@ static void print_object(const unsigned char *sha1, char *path) } idx++; } - htmlf(linefmt, ++lineno); - html_txt(buf + start); + if (start < idx) { + htmlf(linefmt, ++lineno); + html_txt(buf + start); + } html("</td></tr>\n"); html("</table>\n"); } |