]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-commit.c
display subject instead of sha1 as link title of parents
[ps-cgit] / ui-commit.c
index f5b0ae553be5edfaa58a5b7fbcbef6d9a29eb776..4d4970f8e2e90a6a206c786e70ff445b84718cff 100644 (file)
@@ -15,7 +15,7 @@
 void cgit_print_commit(char *hex)
 {
        struct commit *commit, *parent;
-       struct commitinfo *info;
+       struct commitinfo *info, *parent_info;
        struct commit_list *p;
        unsigned char sha1[20];
        char *tmp;
@@ -58,9 +58,14 @@ void cgit_print_commit(char *hex)
        html("</td></tr>\n");
        html("<tr><th>commit</th><td colspan='2' class='sha1'>");
        tmp = sha1_to_hex(commit->object.sha1);
-       cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp);
+       cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, 0);
        html(" (");
        cgit_patch_link("patch", NULL, NULL, NULL, tmp);
+       html(") (");
+       if ((ctx.qry.ssdiff && !ctx.cfg.ssdiff) || (!ctx.qry.ssdiff && ctx.cfg.ssdiff))
+               cgit_commit_link("unidiff", NULL, NULL, ctx.qry.head, tmp, 1);
+       else
+               cgit_commit_link("side-by-side diff", NULL, NULL, ctx.qry.head, tmp, 1);
        html(")</td></tr>\n");
        html("<tr><th>tree</th><td colspan='2' class='sha1'>");
        tmp = xstrdup(hex);
@@ -77,11 +82,13 @@ void cgit_print_commit(char *hex)
                }
                html("<tr><th>parent</th>"
                     "<td colspan='2' class='sha1'>");
-               cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL,
-                                ctx.qry.head, sha1_to_hex(p->item->object.sha1));
+               parent_info = cgit_parse_commit(parent);
+               tmp = sha1_to_hex(p->item->object.sha1);
+               cgit_commit_link(parent_info->subject, NULL, NULL,
+                                ctx.qry.head, tmp, 0);
                html(" (");
                cgit_diff_link("diff", NULL, NULL, ctx.qry.head, hex,
-                              sha1_to_hex(p->item->object.sha1), NULL);
+                              sha1_to_hex(p->item->object.sha1), NULL, 0);
                html(")</td></tr>");
                parents++;
        }