diff options
author | Oscar Benedito <oscar@oscarbenedito.com> | 2020-07-10 14:11:00 +0200 |
---|---|---|
committer | Oscar Benedito <oscar@oscarbenedito.com> | 2020-07-30 12:44:16 +0200 |
commit | d04741c8d606c1c7252c1c91142efe4e84e8d7da (patch) | |
tree | fe61805d7858c7c69c053fe2c3aee16f99aac903 /stagit.c | |
parent | 0cdc59b8fe9a042a0c32875c90b2d5be3c0aad1a (diff) |
Added contributing information
Diffstat (limited to 'stagit.c')
-rw-r--r-- | stagit.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -62,6 +62,8 @@ 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 char *contributefiles[] = { "HEAD:CONTRIBUTING", "HEAD:CONTRIBUTING.md" }; +static char *contribute; static long long nlogcommits = -1; /* < 0 indicates not used */ /* cache */ @@ -385,6 +387,11 @@ writeheader(FILE *fp, const char *title) if (license) fprintf(fp, " | <a href=\"%sfile/%s.html\">LICENSE</a>", relpath, license); + if (contribute) + fprintf(fp, " | <a href=\"%sfile/%s.html\">Contribute</a>", + relpath, contribute); + else + fprintf(fp, " | <a href=\"../%s#contribute\">Contribute</a>", relpath); fputs("</td></tr></table>\n<hr/>\n<div id=\"content\">\n", fp); } @@ -1162,6 +1169,14 @@ main(int argc, char *argv[]) fclose(fpread); } + /* check CONTRIBUTING */ + for (i = 0; i < sizeof(contributefiles) / sizeof(*contributefiles) && !contribute; i++) { + if (!git_revparse_single(&obj, repo, contributefiles[i]) && + git_object_type(obj) == GIT_OBJ_BLOB) + contribute = contributefiles[i] + strlen("HEAD:"); + git_object_free(obj); + } + /* check LICENSE */ for (i = 0; i < sizeof(licensefiles) / sizeof(*licensefiles) && !license; i++) { if (!git_revparse_single(&obj, repo, licensefiles[i]) && |