X-Git-Url: https://git.cameronkatri.com/cgit.git/blobdiff_plain/a4d1ca1dc6ff8171694d9e2280b6075a1beced0c..8011587ef34d98398b60be8fcd6c6ecf499c0676:/ui-patch.c diff --git a/ui-patch.c b/ui-patch.c index 36bfae4..e60877d 100644 --- a/ui-patch.c +++ b/ui-patch.c @@ -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);