stagit

stagit-index: Strip per repo .git suffix from generated index

sin contact@arjunchoudhary.com

commit: 297005b parent: 6019456
1 files changed, 9 insertions(+), 1 deletions(-)
Mstagit-index.c+9-1
M · stagit-index.c +9, -1
 1@@ -124,6 +124,7 @@ writefooter(FILE *fp)
 2 int
 3 writelog(FILE *fp)
 4 {
 5+	char *stripped_name, *p;
 6 	git_commit *commit = NULL;
 7 	const git_signature *author;
 8 	git_revwalk *w = NULL;
 9@@ -146,7 +147,14 @@ writelog(FILE *fp)
10 	fputs("<tr><td><a href=\"", fp);
11 	xmlencode(fp, name, strlen(name));
12 	fputs("/log.html\">", fp);
13-	xmlencode(fp, name, strlen(name));
14+
15+	/* strip .git suffix */
16+	if (!(stripped_name = strdup(name)))
17+		err(1, "strdup");
18+	if ((p = strrchr(stripped_name, '.')))
19+		*p = '\0';
20+	xmlencode(fp, stripped_name, strlen(stripped_name));
21+
22 	fputs("</a></td><td>", fp);
23 	xmlencode(fp, description, strlen(description));
24 	fputs("</td><td>", fp);