]> git.cameronkatri.com Git - cgit.git/blobdiff - ui-patch.c
filters: toggle perl utf8 situation
[cgit.git] / ui-patch.c
index ca008f360c4e73d0af3f15980379409845c86ab6..fbb92cc4eca31de7cf9d998c3cec46a0e1937ccb 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 #include "cgit.h"
+#include "ui-patch.h"
 #include "html.h"
 #include "ui-shared.h"
 
@@ -28,11 +29,6 @@ static void header(unsigned char *sha1, char *path1, int mode1,
        subproject = (S_ISGITLINK(mode1) || S_ISGITLINK(mode2));
        htmlf("diff --git a/%s b/%s\n", path1, path2);
 
-       if (is_null_sha1(sha1))
-               path1 = "dev/null";
-       if (is_null_sha1(sha2))
-               path2 = "dev/null";
-
        if (mode1 == 0)
                htmlf("new file mode %.6o\n", mode2);
 
@@ -50,8 +46,18 @@ static void header(unsigned char *sha1, char *path1, int mode1,
                        if (mode2 != mode1)
                                htmlf("..%.6o", mode2);
                }
-               htmlf("\n--- a/%s\n", path1);
-               htmlf("+++ b/%s\n", path2);
+
+               if (is_null_sha1(sha1)) {
+                       path1 = "dev/null";
+                       htmlf("\n--- /%s\n", path1);
+               } else
+                       htmlf("\n--- a/%s\n", path1);
+
+               if (is_null_sha1(sha2)) {
+                       path2 = "dev/null";
+                       htmlf("+++ /%s\n", path2);
+               } else
+                       htmlf("+++ b/%s\n", path2);
        }
 }
 
@@ -88,12 +94,12 @@ void cgit_print_patch(char *hex, const char *prefix)
                hex = ctx.qry.head;
 
        if (get_sha1(hex, sha1)) {
-               cgit_print_error(fmt("Bad object id: %s", hex));
+               cgit_print_error("Bad object id: %s", hex);
                return;
        }
        commit = lookup_commit_reference(sha1);
        if (!commit) {
-               cgit_print_error(fmt("Bad commit reference: %s", hex));
+               cgit_print_error("Bad commit reference: %s", hex);
                return;
        }
        info = cgit_parse_commit(commit);
@@ -126,6 +132,6 @@ void cgit_print_patch(char *hex, const char *prefix)
                htmlf("(limited to '%s')\n\n", prefix);
        cgit_diff_tree(old_sha1, sha1, filepair_cb, prefix, 0);
        html("--\n");
-       htmlf("cgit %s\n", CGIT_VERSION);
+       htmlf("cgit %s\n", cgit_version);
        cgit_free_commitinfo(info);
 }