diff --git a/stagit.c b/stagit.c index 90fd7d1..f43801d 100644 --- a/stagit.c +++ b/stagit.c @@ -56,12 +56,16 @@ static char *name = ""; static char *strippedname = ""; static char description[255]; static char cloneurl[1024]; -static int haslicense, hasreadme, hassubmodules; +static char *submodules; +static char *licensefiles[] = { "HEAD:LICENSE", "HEAD:LICENSE.md", "HEAD:COPYING" }; +static char *license; +static char *readmefiles[] = { "HEAD:README", "HEAD:README.md" }; +static char *readme; static long long nlogcommits = -1; /* < 0 indicates not used */ /* cache */ static git_oid lastoid; -static char lastoidstr[GIT_OID_HEXSZ + 2]; /* id + newline + nul byte */ +static char lastoidstr[GIT_OID_HEXSZ + 2]; /* id + newline + NUL byte */ static FILE *rcachefp, *wcachefp; static const char *cachefile; @@ -366,12 +370,15 @@ writeheader(FILE *fp, const char *title) fprintf(fp, "Log | ", relpath); fprintf(fp, "Files | ", relpath); fprintf(fp, "Refs", relpath); - if (hassubmodules) - fprintf(fp, " | Submodules", relpath); - if (hasreadme) - fprintf(fp, " | README", relpath); - if (haslicense) - fprintf(fp, " | LICENSE", relpath); + if (submodules) + fprintf(fp, " | Submodules", + relpath, submodules); + if (readme) + fprintf(fp, " | README", + relpath, readme); + if (license) + fprintf(fp, " | LICENSE", + relpath, license); fputs("\n