]> git.armaanb.net Git - stagit.git/blobdiff - src/stagit.c
Copy files.html to index.html
[stagit.git] / src / stagit.c
index 6e20754ed9fe82f23f4ba30789bc13d31aef08d1..9a13e6639f9e2cc6b524113aa56927f75407b722 100644 (file)
@@ -364,7 +364,7 @@ writeheader(FILE *fp, const char *title)
                relpath, relpath);
        fputs("</td><td><h1>", fp);
        xmlencode(fp, strippedname, strlen(strippedname));
-       fputs("</h1><span class=\"desc\">", fp);
+       fputs("</h1></td></tr><tr><td></td><td><span class=\"desc\">", fp);
        xmlencode(fp, description, strlen(description));
        fputs("</span></td></tr>", fp);
        if (cloneurl[0]) {
@@ -387,6 +387,8 @@ writeheader(FILE *fp, const char *title)
        if (license)
                fprintf(fp, " | <a href=\"%sfile/%s.html\">LICENSE</a>",
                        relpath, license);
+       fprintf(fp, " | <a href=\"%s%s.tar.gz\">Download</a>",
+                                       relpath, strippedname);
        fputs("</td></tr></table>\n<hr/>\n<div id=\"content\">\n", fp);
 }
 
@@ -431,7 +433,7 @@ call_chroma(const char *filename, FILE *fp, const char *s, size_t len)
        return lc;
 }
 
-       int
+int
 writeblobhtml(const char *filename, FILE *fp, const git_blob *blob)
 {
        int lc = 0;
@@ -445,7 +447,7 @@ writeblobhtml(const char *filename, FILE *fp, const git_blob *blob)
        return lc;
 }
 
-       void
+void
 printcommit(FILE *fp, struct commitinfo *ci)
 {
        fprintf(fp, "<b>commit</b> <a href=\"%scommit/%s.html\">%s</a>\n",
@@ -473,7 +475,7 @@ printcommit(FILE *fp, struct commitinfo *ci)
        }
 }
 
-       void
+void
 printshowfile(FILE *fp, struct commitinfo *ci)
 {
        const git_diff_delta *delta;
@@ -1209,6 +1211,12 @@ main(int argc, char *argv[])
                submodules = ".gitmodules";
        git_object_free(obj);
 
+       /* Generate tarball */
+       char tarball[255];
+       sprintf(tarball, "tar -zcf %s.tar.gz --ignore-failed-read --exclude='.git' %s",
+                           strippedname, repodir);
+       system(tarball);
+
        /* log for HEAD */
        fp = efopen("log.html", "w");
        relpath = "";
@@ -1270,6 +1278,8 @@ main(int argc, char *argv[])
        writefooter(fp);
        fclose(fp);
 
+       cp("files.html", "index.html");
+
        /* summary page with branches and tags */
        fp = efopen("refs.html", "w");
        writeheader(fp, "Refs");