]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-log.c
Makefile: install cgit.{css,png} in CGIT_DATA_PATH
[ps-cgit] / ui-log.c
index 9b2ffb68d8b088b3f396d1d12f741a626af495b8..d2129844032d59aebfa8172c3a6f34e8ad85c2cf 100644 (file)
--- a/ui-log.c
+++ b/ui-log.c
@@ -34,10 +34,15 @@ void inspect_files(struct diff_filepair *pair)
 void print_commit(struct commit *commit)
 {
        struct commitinfo *info;
 void print_commit(struct commit *commit)
 {
        struct commitinfo *info;
+       char *tmp;
 
        info = cgit_parse_commit(commit);
        html("<tr><td>");
 
        info = cgit_parse_commit(commit);
        html("<tr><td>");
+       tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1));
+       tmp = cgit_pageurl(ctx.repo->url, "commit", tmp);
+       html_link_open(tmp, NULL, NULL);
        cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE);
        cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE);
+       html_link_close();
        html("</td><td>");
        cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head,
                         sha1_to_hex(commit->object.sha1));
        html("</td><td>");
        cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head,
                         sha1_to_hex(commit->object.sha1));
@@ -59,18 +64,31 @@ void print_commit(struct commit *commit)
        cgit_free_commitinfo(info);
 }
 
        cgit_free_commitinfo(info);
 }
 
+static const char *disambiguate_ref(const char *ref)
+{
+       unsigned char sha1[20];
+       const char *longref;
+
+       longref = fmt("refs/heads/%s", ref);
+       if (get_sha1(longref, sha1) == 0)
+               return longref;
+
+       return ref;
+}
 
 void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern,
                    char *path, int pager)
 {
        struct rev_info rev;
        struct commit *commit;
 
 void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern,
                    char *path, int pager)
 {
        struct rev_info rev;
        struct commit *commit;
-       const char *argv[] = {NULL, tip, NULL, NULL, NULL};
+       const char *argv[] = {NULL, NULL, NULL, NULL, NULL};
        int argc = 2;
        int i, columns = 3;
 
        if (!tip)
        int argc = 2;
        int i, columns = 3;
 
        if (!tip)
-               argv[1] = ctx.qry.head;
+               tip = ctx.qry.head;
+
+       argv[1] = disambiguate_ref(tip);
 
        if (grep && pattern && (!strcmp(grep, "grep") ||
                                !strcmp(grep, "author") ||
 
        if (grep && pattern && (!strcmp(grep, "grep") ||
                                !strcmp(grep, "author") ||
@@ -87,10 +105,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);
        rev.verbose_header = 1;
        rev.show_root_diff = 0;
        setup_revisions(argc, argv, &rev, NULL);
-       if (rev.grep_filter) {
-               rev.grep_filter->regflags |= REG_ICASE;
-               compile_grep_patterns(rev.grep_filter);
-       }
+       rev.grep_filter.regflags |= REG_ICASE;
+       compile_grep_patterns(&rev.grep_filter);
        prepare_revision_walk(&rev);
 
        if (pager)
        prepare_revision_walk(&rev);
 
        if (pager)