stagit
Personal fork of stagit
git clone git://mccd.space/stagitcommit 40d3ebf520ba3685125ef0d775c521b321657ce4
parent d1e5d41e9ba277e7c87e2be4de8f3d473f1662b1
Author: Marc <marc@coquand.email>
Date: Tue, 7 Jul 2026 16:15:09 +0200
Add contrib file
Diffstat:
1 file changed, 22 insertions(+), 0 deletions(-)
diff --git a/stagit.c b/stagit.c
@@ -65,6 +65,7 @@ static const char *repodir;
static char *name = "";
static char *strippedname = "";
static char description[255];
+static char contrib[1024];
static char cloneurl[1024];
static char *submodules;
static char *licensefiles[] = { "HEAD:LICENSE", "HEAD:LICENSE.md", "HEAD:LICENSE.txt", "HEAD:COPYING" };
@@ -534,6 +535,13 @@ writeheader(FILE *fp, const char *title)
xmlencode(fp, cloneurl, strlen(cloneurl));
fputs("</a></p>", fp);
}
+ if (contrib[0]) {
+ fputs("<p class=\"contribute\">Patches & Comments: <a href=\"", fp);
+ xmlencode(fp, contrib, strlen(contrib)); /* not percent-encoded */
+ fputs("\">", fp);
+ xmlencode(fp, contrib, strlen(contrib));
+ fputs("</a></p>", fp);
+ }
fputs("<table><tbody><tr><td id=\"links\">\n", fp);
fprintf(fp, "<a href=\"%slog.html\">Log</a> | ", relpath);
fprintf(fp, "<a href=\"%sfiles.html\">Files</a> | ", relpath);
@@ -1289,6 +1297,20 @@ main(int argc, char *argv[])
checkfileerror(fpread, path, 'r');
fclose(fpread);
}
+
+ /* read contrib or .git/contrib */
+ joinpath(path, sizeof(path), repodir, "contrib");
+ if (!(fpread = fopen(path, "r"))) {
+ joinpath(path, sizeof(path), repodir, ".git/contrib");
+ fpread = fopen(path, "r");
+ }
+ if (fpread) {
+ if (!fgets(contrib, sizeof(contr), fpread))
+ contr[0] = '\0';
+ checkfileerror(fpread, path, 'r');
+ fclose(fpread);
+ }
+
/* read url or .git/url */
joinpath(path, sizeof(path), repodir, "url");