]> gitweb.ps.run Git - ps-cgit/commitdiff
Merge branch 'lh/virtual-root'
authorLars Hjemli <hjemli@gmail.com>
Sun, 11 Jan 2009 11:22:19 +0000 (12:22 +0100)
committerLars Hjemli <hjemli@gmail.com>
Sun, 11 Jan 2009 11:22:19 +0000 (12:22 +0100)
Makefile
cgit.css
git
shared.c
tests/t0104-tree.sh
ui-log.c
ui-patch.c
ui-refs.c
ui-tree.c

index 2e51c319c4e1830021df363ea4c9d1f4404a88d7..036fcd7d503fc2c04dd958eac9c5c98921864fbe 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -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
index 7928c2f4f86f0b597a3b992ff7815adca1d4bef0..f19446dfbccfffd727b97793fc84dda1115805f9 100644 (file)
--- a/cgit.css
+++ b/cgit.css
@@ -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
index 031e6c898f61db1ae0c0be641eac6532c1000d56..8104ebfe8276657ee803cca7eb8665a78cf3ef83 160000 (submodule)
--- a/git
+++ b/git
@@ -1 +1 @@
-Subproject commit 031e6c898f61db1ae0c0be641eac6532c1000d56
+Subproject commit 8104ebfe8276657ee803cca7eb8665a78cf3ef83
index 89d1bab90f9e6d4f53ee873dfffb4fb9515bedbd..a764c4d6b25bbde782cafe159c0bef05ccc98f21 100644 (file)
--- a/shared.c
+++ b/shared.c
@@ -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);
index 0d62cc82c5d5dbbc90e351a73e3c748e427ba7c0..33f4eb00ff2808e9f4335b397e809d695b464301 100755 (executable)
@@ -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'
index 2f90778c70b22d80a6282eea60190f2cdf78c521..c3757dd0131d75c2764dc0a0931a57085b7fc8b5 100644 (file)
--- a/ui-log.c
+++ b/ui-log.c
@@ -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);
index e60877d8ed2fcf2a6a76dab90d08b5eadcc9ea6f..1d7733645d68efb41e682fa8e24c80dc9f8958df 100644 (file)
@@ -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);
index d61ee7c8d150d1adf5da535148bf9a1114f1440a..c35e694e8e6517811ad808849dc5d88474901f59 100644 (file)
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -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);
index 051db7cb28cbf2321ca67582aac866596743a465..9876c9972e9558f82632d03280997cc8db234fac 100644 (file)
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -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");
 }