ctucx.git: stagit

ctucx' stagit fork

commit de4a14d2504ba36d0c4eea52a8f1978d6a180cc4
parent 9f9634f97515dbd4b94a3cb84c2e020ed6027e7f
Author: Leah (ctucx) <leah@ctu.cx>
Date: Tue, 24 May 2022 14:57:56 +0200

about: show clone-urls if available
1 file changed, 8 insertions(+), 0 deletions(-)
M
stagit.c
|
8
++++++++
diff --git a/stagit.c b/stagit.c
@@ -1415,6 +1415,7 @@ main(int argc, char *argv[])
 		git_revwalk_new(&walker, repo);
 		git_revwalk_push(walker, head);
 
+		if (http_cloneurl[0] || ssh_cloneurl[0]) fputs("<div class=\"container\"><div class=\"row\"><div class=\"col-8\">", fp);
 		fputs("<h3>last commits</h3><div class=\"log\">", fp);
 		while (!git_revwalk_next(&id, walker)) {
 			if (!(ci = commitinfo_getbyoid(&id))) break;

@@ -1431,6 +1432,13 @@ main(int argc, char *argv[])
 		git_revwalk_free(walker);
 		fputs("</div>", fp);
 
+		if (http_cloneurl[0] || ssh_cloneurl[0]) {
+			fputs("</div><div class=\"col-4\"><h3>clone</h3>", fp);
+			if (http_cloneurl[0]) fprintf(fp, "<dl><dt>read-only</dt><dd>%s%s</dd></dl>", http_cloneurl, strippedname);
+			if (ssh_cloneurl[0])  fprintf(fp, "<dl><dt>read-write</dt><dd>%s%s</dd></dl>", ssh_cloneurl, strippedname);
+			fputs("</div></div></div>", fp);
+        };
+
 		git_revparse_single(&obj, repo, readmefiles[r]);
 		const char *s = git_blob_rawcontent((git_blob *)obj);
 		if (r == 1 | r == 2) {