stagit

static git page generator - with my changes
git clone https://pi.duncano.de/git/stagit.git
Log | Files | Refs | README | LICENSE

commit 628415dd542fa6cbebc5b89a361e6ff4a1f3d4f6
parent 7c8d6ceaae505647a8eabd2cdb129ccc8a3f7696
Author: Duncaen <mail@duncano.de>
Date:   Thu, 16 Feb 2017 00:59:12 +0100

add fallbacks for README and LICENSE

Diffstat:
stagit.c | 16+++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/stagit.c b/stagit.c @@ -55,7 +55,7 @@ static char *name = ""; static char *strippedname = ""; static char description[255]; static char cloneurl[1024]; -static int haslicense, hasreadme, hassubmodules; +static int haslicense, hascopying, hasreadme, hasreadmemd, hassubmodules; /* cache */ static git_oid lastoid; @@ -354,8 +354,12 @@ writeheader(FILE *fp, const char *title) fprintf(fp, " | <a href=\"%sfile/.gitmodules.html\">Submodules</a>", relpath); if (hasreadme) fprintf(fp, " | <a href=\"%sfile/README.html\">README</a>", relpath); + else if (hasreadmemd) + fprintf(fp, " | <a href=\"%sfile/README.md.html\">README</a>", relpath); if (haslicense) fprintf(fp, " | <a href=\"%sfile/LICENSE.html\">LICENSE</a>", relpath); + else if (hascopying) + fprintf(fp, " | <a href=\"%sfile/COPYING.html\">COPYING</a>", relpath); fputs("</td></tr></table>\n<hr/>\n<div id=\"content\">\n", fp); } @@ -1101,11 +1105,21 @@ main(int argc, char *argv[]) git_object_type(obj) == GIT_OBJ_BLOB); git_object_free(obj); + /* check COPYING */ + hascopying = (!git_revparse_single(&obj, repo, "HEAD:COPYING") && + git_object_type(obj) == GIT_OBJ_BLOB); + git_object_free(obj); + /* check README */ hasreadme = (!git_revparse_single(&obj, repo, "HEAD:README") && git_object_type(obj) == GIT_OBJ_BLOB); git_object_free(obj); + /* check README.md */ + hasreadmemd = (!git_revparse_single(&obj, repo, "HEAD:README.md") && + git_object_type(obj) == GIT_OBJ_BLOB); + git_object_free(obj); + hassubmodules = (!git_revparse_single(&obj, repo, "HEAD:.gitmodules") && git_object_type(obj) == GIT_OBJ_BLOB); git_object_free(obj);