summaryrefslogtreecommitdiff
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
parent0cdc59b8fe9a042a0c32875c90b2d5be3c0aad1a (diff)
Added contributing information
-rw-r--r--stagit-index.c8
-rw-r--r--stagit.c15
-rw-r--r--style.css10
3 files changed, 32 insertions, 1 deletions
diff --git a/stagit-index.c b/stagit-index.c
index b107cac..c4bdd22 100644
--- a/stagit-index.c
+++ b/stagit-index.c
@@ -86,7 +86,13 @@ writeheader(FILE *fp)
void
writefooter(FILE *fp)
{
- fputs("</tbody>\n</table>\n</div>\n</body>\n</html>\n", fp);
+ fputs("</tbody>\n</table>\n</div>\n"
+ "<div id=\"contribute\">\n"
+ "<h1>Contribute</h1>\n"
+ "<p>The best way to contribute to my repositories is through e-mail, check out <a href=\"https://git-send-email.io\">git-send-email.io</a> if you don’t know how to do that. Send your patches to <a href=\"mailto:patches@oscarbenedito.com\">patches@oscarbenedito.com</a> and change the subject prefix to specify the repository you are sending the patch for. You can do that running the following command from the git repository:</p>\n"
+ "<pre><code>git config format.subjectPrefix \"PATCH &lt;name-of-repository&gt;\"</code></pre>\n"
+ "<p>You can also contribute on <a href=\"https://gitlab.com/oscarbenedito\">GitLab</a> or <a href=\"https://github.com/oscarbenedito\">GitHub</a> (all my public repositories should be on both platforms) doing pull requests.</p>\n"
+ "</div>\n</body>\n</html>\n", fp);
}
int
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]) &&
diff --git a/style.css b/style.css
index 6a8c592..f17619c 100644
--- a/style.css
+++ b/style.css
@@ -22,6 +22,16 @@ body {
margin: auto;
}
+#contribute {
+ max-width: 800px;
+ margin: auto;
+ margin-top: 2.5em;
+}
+
+#contribute h1 {
+ font-size: 1.25em;
+}
+
#log, #index {
min-width: 600px;
overflow-x: auto;