stagit-index: Strip per repo .git suffix from generated index
authorsin <sin@2f30.org>
Wed, 6 Jan 2016 14:46:40 +0000 (14:46 +0000)
committersin <sin@2f30.org>
Wed, 6 Jan 2016 14:48:50 +0000 (14:48 +0000)
stagit-index.c

index 540fda1b9b40315a030146fc9884f35eef5c0e49..44b603cddf72d8aae6e843a66406b37ca0a64590 100644 (file)
@@ -124,6 +124,7 @@ writefooter(FILE *fp)
 int
 writelog(FILE *fp)
 {
+       char *stripped_name, *p;
        git_commit *commit = NULL;
        const git_signature *author;
        git_revwalk *w = NULL;
@@ -146,7 +147,14 @@ writelog(FILE *fp)
        fputs("<tr><td><a href=\"", fp);
        xmlencode(fp, name, strlen(name));
        fputs("/log.html\">", fp);
-       xmlencode(fp, name, strlen(name));
+
+       /* strip .git suffix */
+       if (!(stripped_name = strdup(name)))
+               err(1, "strdup");
+       if ((p = strrchr(stripped_name, '.')))
+               *p = '\0';
+       xmlencode(fp, stripped_name, strlen(stripped_name));
+
        fputs("</a></td><td>", fp);
        xmlencode(fp, description, strlen(description));
        fputs("</td><td>", fp);