]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-diff.c
ui-repolist: add support for sorting any column
[ps-cgit] / ui-diff.c
index 625b5fddd17418ec78dec2b736a03a2a1f1a8eed..878496d43430fc2a9770f6cb43431a7e1b5d7d90 100644 (file)
--- a/ui-diff.c
+++ b/ui-diff.c
@@ -16,7 +16,6 @@ unsigned char new_rev_sha1[20];
 static int files, slots;
 static int total_adds, total_rems, max_changes;
 static int lines_added, lines_removed;
-static char *curr_rev;
 
 static struct fileinfo {
        char status;
@@ -80,8 +79,8 @@ static void print_fileinfo(struct fileinfo *info)
                html("]</span>");
        }
        htmlf("</td><td class='%s'>", class);
-       cgit_diff_link(info->new_path, NULL, NULL, ctx.qry.head, curr_rev,
-                      NULL, info->new_path);
+       cgit_diff_link(info->new_path, NULL, NULL, ctx.qry.head, ctx.qry.sha1,
+                      ctx.qry.sha2, info->new_path);
        if (info->status == DIFF_STATUS_COPIED || info->status == DIFF_STATUS_RENAMED)
                htmlf(" (%s from %s)",
                      info->status == DIFF_STATUS_COPIED ? "copied" : "renamed",
@@ -142,7 +141,10 @@ void cgit_print_diffstat(const unsigned char *old_sha1,
 {
        int i;
 
-       html("<div class='diffstat-header'>Diffstat</div>");
+       html("<div class='diffstat-header'>");
+       cgit_diff_link("Diffstat", NULL, NULL, ctx.qry.head, ctx.qry.sha1,
+                      ctx.qry.sha2, NULL);
+       html("</div>");
        html("<table summary='diffstat' class='diffstat'>");
        max_changes = 0;
        cgit_diff_tree(old_sha1, new_sha1, inspect_filepair, NULL);
@@ -258,12 +260,6 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefi
                cgit_print_error(fmt("Bad object name: %s", new_rev));
                return;
        }
-       if (type != OBJ_COMMIT) {
-               cgit_print_error(fmt("Unhandled object type: %s",
-                                    typename(type)));
-               return;
-       }
-
        commit = lookup_commit_reference(new_rev_sha1);
        if (!commit || parse_commit(commit))
                cgit_print_error(fmt("Bad commit: %s", sha1_to_hex(new_rev_sha1)));