]> git.cameronkatri.com Git - cgit.git/blobdiff - ui-patch.c
Merge branch 'stable'
[cgit.git] / ui-patch.c
index 36bfae4836df393cd1c24c94b58e15702e2bc134..e60877d8ed2fcf2a6a76dab90d08b5eadcc9ea6f 100644 (file)
@@ -90,7 +90,11 @@ void cgit_print_patch(char *hex)
                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";
@@ -99,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: ");
-       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);