fix: check readme and license before writing header - stagit-gopher - A git gopher frontend. (mirror)
git clone git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/stagit-gopher/
Log
Files
Refs
Tags
README
LICENSE
---
commit 9b100464647ccbef09e5fe9f6e41e793c93f9753
parent 0808028312c76abf2fdd51678bd8ce28c2e8b2a5
Author: Hiltjo Posthuma 
Date:   Mon,  7 Dec 2015 19:00:53 +0100

fix: check readme and license before writing header

Diffstat:
  M urmoms.c                            |      11 +++++++----

1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/urmoms.c b/urmoms.c
@@ -578,6 +578,13 @@ main(int argc, char *argv[])
         }
 
         /* 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");
                 writeheader(fp);
@@ -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");