]> git.cameronkatri.com Git - cgit.git/blobdiff - ui-patch.c
Teach cgit how to use PATH_INFO
[cgit.git] / ui-patch.c
index 68ebb152781bb1352c0003d2ae87f64c2537a7b9..e60877d8ed2fcf2a6a76dab90d08b5eadcc9ea6f 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "cgit.h"
 #include "html.h"
 
 #include "cgit.h"
 #include "html.h"
+#include "ui-shared.h"
 
 static void print_line(char *line, int len)
 {
 
 static void print_line(char *line, int len)
 {
@@ -89,7 +90,11 @@ void cgit_print_patch(char *hex)
                return;
        }
        info = cgit_parse_commit(commit);
                return;
        }
        info = cgit_parse_commit(commit);
-       hashcpy(old_sha1, commit->parents->item->object.sha1);
+
+       if (commit->parents && commit->parents->item)
+               hashcpy(old_sha1, commit->parents->item->object.sha1);
+       else
+               hashclr(old_sha1);
 
        patchname = fmt("%s.patch", sha1_to_hex(sha1));
        ctx.page.mimetype = "text/plain";
 
        patchname = fmt("%s.patch", sha1_to_hex(sha1));
        ctx.page.mimetype = "text/plain";
@@ -98,7 +103,7 @@ void cgit_print_patch(char *hex)
        htmlf("From %s Mon Sep 17 00:00:00 2001\n", sha1_to_hex(sha1));
        htmlf("From: %s%s\n", info->author, info->author_email);
        html("Date: ");
        htmlf("From %s Mon Sep 17 00:00:00 2001\n", sha1_to_hex(sha1));
        htmlf("From: %s%s\n", info->author, info->author_email);
        html("Date: ");
-       cgit_print_date(info->author_date, "%a, %d  %b  %Y  %H:%M:%S  %z%n");
+       cgit_print_date(info->author_date, "%a, %d  %b  %Y  %H:%M:%S  %z%n", ctx.cfg.local_time);
        htmlf("Subject: %s\n\n", info->subject);
        if (info->msg && *info->msg) {
                htmlf("%s", info->msg);
        htmlf("Subject: %s\n\n", info->subject);
        if (info->msg && *info->msg) {
                htmlf("%s", info->msg);