commit 30079c9753d4aae39dbd4acc66d18ab5d39df557
parent 77377e790faadb18caff67d769ac93d953556487
Author: gearsix <gearsix@tuta.io>
Date: Thu, 15 Apr 2021 16:10:14 +0100
added .git/fork support to stagit.c
if a .git/fork file is present, then it's read for a url - this url gets
appended to the description (forked from <a href="...">...</a>)
also removed stagit-index binary, accidental commit
Diffstat:
1 file changed, 22 insertions(+), 0 deletions(-)
diff --git a/stagit.c b/stagit.c
@@ -1160,6 +1160,7 @@ main(int argc, char *argv[])
FILE *fp, *fpread;
char path[PATH_MAX], repodirabs[PATH_MAX + 1], *p;
char tmppath[64] = "cache.XXXXXXXXXXXX", buf[BUFSIZ];
+ char pre[20], url[235];
size_t n;
int i, fd;
@@ -1247,6 +1248,27 @@ main(int argc, char *argv[])
fclose(fpread);
}
+ /* read .git/fork */
+ joinpath(path, sizeof(path), repodir, ".git/fork");
+ if (fpread = fopen(path, "r")) {
+ if (fgets(url, sizeof(url), fpread)) {
+ if (strlen(description) == 0)
+ snprintf(pre, 20, "forked from <a href=\"");
+ else
+ snprintf(pre, 20, ", forked form <a href=\"");
+
+ if (strlen(description) + strlen(pre) + strlen(url) < 255) {
+ strncat(description, pre, strlen(pre));
+ strncat(description, url, strlen(url));
+ }
+
+ strncat(description, "</a>", 5);
+ }
+
+ url[0] = '\0';
+ pre[0] = '\0';
+ }
+
/* read url or .git/url */
joinpath(path, sizeof(path), repodir, "url");
if (!(fpread = fopen(path, "r"))) {