summaryrefslogtreecommitdiff
path: root/stagit.c
diff options
context:
space:
mode:
authorOscar Benedito <oscar@oscarbenedito.com>2020-07-10 14:11:00 +0200
committerOscar Benedito <oscar@oscarbenedito.com>2020-07-30 12:44:16 +0200
commitd04741c8d606c1c7252c1c91142efe4e84e8d7da (patch)
treefe61805d7858c7c69c053fe2c3aee16f99aac903 /stagit.c
parent0cdc59b8fe9a042a0c32875c90b2d5be3c0aad1a (diff)
Added contributing information
Diffstat (limited to 'stagit.c')
-rw-r--r--stagit.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/stagit.c b/stagit.c
index da1c226..e7965f1 100644
--- a/stagit.c
+++ b/stagit.c
@@ -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]) &&