]> git.armaanb.net Git - stagit.git/commitdiff
stagit: generate tar archive for each repo
authorArmaan Bhojwani <me@armaanb.net>
Mon, 5 Apr 2021 22:22:12 +0000 (18:22 -0400)
committerArmaan Bhojwani <me@armaanb.net>
Mon, 5 Apr 2021 22:22:36 +0000 (18:22 -0400)
src/stagit.c

index d1bf33c3eacb72bccab8391a3b10516fcc1c3aa8..cd18b03fd48522bb8f435de1571d97662db37df8 100644 (file)
@@ -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);
 }
 
@@ -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 = "";