fix: check readme and license before writing header
authorHiltjo Posthuma <hiltjo@codemadness.org>
Mon, 7 Dec 2015 18:00:53 +0000 (19:00 +0100)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Mon, 7 Dec 2015 18:00:53 +0000 (19:00 +0100)
urmoms.c

index 6003871a54b4f136c507d689d9dc2bd38a7a1725..a2ef4c5437f4da31148043b14ffb19f733c803e6 100644 (file)
--- 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");