aboutsummaryrefslogtreecommitdiffstats
path: root/stagit-index.c
diff options
context:
space:
mode:
authorsin <[email protected]>2016-01-06 14:46:40 +0000
committersin <[email protected]>2016-01-06 14:48:50 +0000
commitf631d4ce702893c2207b1a12f2c048829c5f5ac7 (patch)
tree6bd275cc197a0e1c897ec67f61332e705bf44776 /stagit-index.c
parentd045340ea048e3aa45af719caadad413efdfda4d (diff)
downloadstagit-f631d4ce702893c2207b1a12f2c048829c5f5ac7.tar.gz
stagit-f631d4ce702893c2207b1a12f2c048829c5f5ac7.zip
stagit-index: Strip per repo .git suffix from generated index
Diffstat (limited to 'stagit-index.c')
-rw-r--r--stagit-index.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/stagit-index.c b/stagit-index.c
index 540fda1..44b603c 100644
--- a/stagit-index.c
+++ b/stagit-index.c
@@ -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);