]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-diff.c
Add prefix parameter to cgit_print_diff()
[ps-cgit] / ui-diff.c
index a76a234cfe61b1fd63a7a3ccc1eb01ad6018b435..ba0030f587d3957fa75493959cf6519edcb3c779 100644 (file)
--- a/ui-diff.c
+++ b/ui-diff.c
@@ -37,7 +37,7 @@ static void header(unsigned char *sha1, char *path1, int mode1,
        char *abbrev1, *abbrev2;
        int subproject;
 
-       subproject = (S_ISDIRLNK(mode1) || S_ISDIRLNK(mode2));
+       subproject = (S_ISGITLINK(mode1) || S_ISGITLINK(mode2));
        html("<div class='head'>");
        html("diff --git a/");
        html_txt(path1);
@@ -78,10 +78,10 @@ static void filepair_cb(struct diff_filepair *pair)
 {
        header(pair->one->sha1, pair->one->path, pair->one->mode,
               pair->two->sha1, pair->two->path, pair->two->mode);
-       if (S_ISDIRLNK(pair->one->mode) || S_ISDIRLNK(pair->two->mode)) {
-               if (S_ISDIRLNK(pair->one->mode))
+       if (S_ISGITLINK(pair->one->mode) || S_ISGITLINK(pair->two->mode)) {
+               if (S_ISGITLINK(pair->one->mode))
                        print_line(fmt("-Subproject %s", sha1_to_hex(pair->one->sha1)), 52);
-               if (S_ISDIRLNK(pair->two->mode))
+               if (S_ISGITLINK(pair->two->mode))
                        print_line(fmt("+Subproject %s", sha1_to_hex(pair->two->sha1)), 52);
                return;
        }
@@ -89,7 +89,7 @@ static void filepair_cb(struct diff_filepair *pair)
                cgit_print_error("Error running diff");
 }
 
-void cgit_print_diff(const char *new_rev, const char *old_rev)
+void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefix)
 {
        unsigned char sha1[20], sha2[20];
        enum object_type type;
@@ -131,10 +131,9 @@ void cgit_print_diff(const char *new_rev, const char *old_rev)
                if (!commit2 || parse_commit(commit2))
                        cgit_print_error(fmt("Bad commit: %s", sha1_to_hex(sha2)));
        }
-
        html("<table class='diff'>");
        html("<tr><td>");
-       cgit_diff_tree(sha2, sha1, filepair_cb);
+       cgit_diff_tree(sha2, sha1, filepair_cb, prefix);
        html("</td></tr>");
        html("</table>");
 }