]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-log.c
return 404 if snapshot is not found
[ps-cgit] / ui-log.c
index adc9a66a5ddc673b6e13171efa735fd2aa95614f..2f90778c70b22d80a6282eea60190f2cdf78c521 100644 (file)
--- a/ui-log.c
+++ b/ui-log.c
@@ -38,19 +38,17 @@ void print_commit(struct commit *commit)
        int cols = 2;
 
        info = cgit_parse_commit(commit);
        int cols = 2;
 
        info = cgit_parse_commit(commit);
-       html("<tr><td>");
+       htmlf("<tr%s><td>",
+               ctx.qry.showmsg ? " class='logheader'" : "");
        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);
        html_link_close();
        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);
        html_link_close();
-       html("</td><td>");
-       if (ctx.qry.showmsg)
-               html("<u>");
+       htmlf("</td><td%s>",
+               ctx.qry.showmsg ? " class='logsubject'" : "");
        cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head,
                         sha1_to_hex(commit->object.sha1));
        cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head,
                         sha1_to_hex(commit->object.sha1));
-       if (ctx.qry.showmsg)
-               html("</u>");
        html("</td><td>");
        html_txt(info->author);
        if (ctx.repo->enable_log_filecount) {
        html("</td><td>");
        html_txt(info->author);
        if (ctx.repo->enable_log_filecount) {
@@ -72,26 +70,39 @@ void print_commit(struct commit *commit)
                        if (ctx.repo->enable_log_linecount)
                                cols++;
                }
                        if (ctx.repo->enable_log_linecount)
                                cols++;
                }
-               htmlf("<tr class='nohover'><td></td><td colspan='%d'><div class='commit-msg'>",
+               htmlf("<tr class='nohover'><td/><td colspan='%d' class='logmsg'>",
                        cols);
                html_txt(info->msg);
                        cols);
                html_txt(info->msg);
-               html("</div><br/></td></tr>\n");
+               html("</td></tr>\n");
        }
        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") ||