ctucx.git: stagit

ctucx' stagit fork

commit b09e5c6200cf3ef21b002b24215737b5ecce9d81
parent 28207c037682d6da9536a5895db1dc2d621a19df
Author: Leah (ctucx) <leah@ctu.cx>
Date: Mon, 23 May 2022 21:55:12 +0200

rename file(s) to tree
1 file changed, 11 insertions(+), 11 deletions(-)
M
stagit.c
|
22
+++++++++++-----------
diff --git a/stagit.c b/stagit.c
@@ -577,16 +577,16 @@ writeheader(FILE *fp, const char *title)
 	if (readme)
 		fprintf(fp, "<a href=\"%sabout.html\">About</a> | ", relpath);
 	fprintf(fp, "<a href=\"%slog.html\">Log</a> | ", relpath);
-	fprintf(fp, "<a href=\"%sfiles.html\">Files</a> | ", relpath);
+	fprintf(fp, "<a href=\"%stree.html\">Files</a> | ", relpath);
 	fprintf(fp, "<a href=\"%srefs.html\">Refs</a>", relpath);
 	if (submodules)
-		fprintf(fp, " | <a href=\"%sfile/%s.html\">Submodules</a>",
+		fprintf(fp, " | <a href=\"%stree/%s.html\">Submodules</a>",
 		        relpath, submodules);
 	if (license)
-		fprintf(fp, " | <a href=\"%sfile/%s.html\">License</a>",
+		fprintf(fp, " | <a href=\"%stree/%s.html\">License</a>",
 		        relpath, license);
 	if (contribute)
-		fprintf(fp, " | <a href=\"%sfile/%s.html\">Contribute</a>",
+		fprintf(fp, " | <a href=\"%stree/%s.html\">Contribute</a>",
 		        relpath, contribute);
 	else
 		fprintf(fp, " | <a href=\"../%s#contribute\">Contribute</a>", relpath);

@@ -1021,7 +1021,7 @@ writefilestree(FILE *fp, git_tree *tree, const char *path)
 			errx(1, "path truncated: '%s'", path);
 		parent = strrchr(tmp, '/');
 		if (parent == NULL)
-			parent = "files";
+			parent = "tree";
 		else {
 			*parent = '\0';
 			parent = strrchr(tmp, '/');

@@ -1042,7 +1042,7 @@ writefilestree(FILE *fp, git_tree *tree, const char *path)
 			return -1;
 		joinpath(entrypath, sizeof(entrypath), path, entryname);
 
-		r = snprintf(filepath, sizeof(filepath), "file/%s.html",
+		r = snprintf(filepath, sizeof(filepath), "tree/%s.html",
 		         entrypath);
 		if (r < 0 || (size_t)r >= sizeof(filepath))
 			errx(1, "path truncated: 'file/%s.html'", entrypath);

@@ -1070,7 +1070,7 @@ writefilestree(FILE *fp, git_tree *tree, const char *path)
 				oldrelpath = relpath;
 				relpath = tmp;
 				fp_subtree = efopen(filepath, "w");
-				strlcpy(tmp2, "Files - ", sizeof(tmp2));
+				strlcpy(tmp2, "tree - ", sizeof(tmp2));
 				if (strlcat(tmp2, entrypath, sizeof(tmp2)) >= sizeof(tmp2))
 					errx(1, "path truncated: '%s'", tmp2);
 				writeheader(fp_subtree, tmp2);

@@ -1107,7 +1107,7 @@ writefilestree(FILE *fp, git_tree *tree, const char *path)
 			git_object_free(obj);
 		} else if (git_tree_entry_type(entry) == GIT_OBJ_COMMIT) {
 			/* commit object in tree is a submodule */
-			fprintf(fp, "<tr><td>m---------</td><td><a href=\"%sfile/.gitmodules.html\">",
+			fprintf(fp, "<tr><td>m---------</td><td><a href=\"%stree/.gitmodules.html\">",
 				relpath);
 			xmlencode(fp, entrypath, strlen(entrypath));
 			fputs("</a> @ ", fp);

@@ -1430,12 +1430,12 @@ main(int argc, char *argv[])
 	fclose(fp);
 
 	/* files for HEAD */
-	fp = efopen("files.html", "w");
-	writeheader(fp, "Files");
+	fp = efopen("tree.html", "w");
+	writeheader(fp, "tree");
 	if (head)
 		writefiles(fp, head);
 	writefooter(fp);
-	checkfileerror(fp, "files.html", 'w');
+	checkfileerror(fp, "tree.html", 'w');
 	fclose(fp);
 
 	/* summary page with branches and tags */