From: Hiltjo Posthuma Date: Mon, 7 Dec 2015 18:00:53 +0000 (+0100) Subject: fix: check readme and license before writing header X-Git-Url: https://git.atheridis.org/?a=commitdiff_plain;h=9b100464647ccbef09e5fe9f6e41e793c93f9753;p=forks%2Fstagit.git fix: check readme and license before writing header --- diff --git a/urmoms.c b/urmoms.c index 6003871..a2ef4c5 100644 --- a/urmoms.c +++ b/urmoms.c @@ -577,6 +577,13 @@ main(int argc, char *argv[]) fclose(fpread); } + /* read LICENSE */ + if (!git_revparse_single(&obj, repo, "HEAD:LICENSE")) + haslicense = 1; + /* read README */ + if (!git_revparse_single(&obj, repo, "HEAD:README")) + hasreadme = 1; + /* read LICENSE */ if (!git_revparse_single(&obj, repo, "HEAD:LICENSE")) { fp = efopen("license.html", "w+b"); @@ -587,8 +594,6 @@ main(int argc, char *argv[]) writefooter(fp); fclose(fp); - - haslicense = 1; } /* read README */ @@ -600,8 +605,6 @@ main(int argc, char *argv[]) err(1, "fwrite"); writefooter(fp); fclose(fp); - - hasreadme = 1; } fp = efopen("log.html", "w+b");