commit d04741c8d606c1c7252c1c91142efe4e84e8d7da
parent 0cdc59b8fe9a042a0c32875c90b2d5be3c0aad1a
Author: Oscar Benedito <oscar@oscarbenedito.com>
Date:   Fri, 10 Jul 2020 14:11:00 +0200

Added contributing information

Diffstat:
Mstagit-index.c | 8+++++++-
Mstagit.c | 15+++++++++++++++
Mstyle.css | 10++++++++++
3 files changed, 32 insertions(+), 1 deletion(-)

diff --git 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 @@ -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 @@ -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;