From: sin Date: Wed, 6 Jan 2016 14:46:40 +0000 (+0000) Subject: stagit-index: Strip per repo .git suffix from generated index X-Git-Url: https://git.atheridis.org/?a=commitdiff_plain;h=f631d4ce702893c2207b1a12f2c048829c5f5ac7;p=forks%2Fstagit.git stagit-index: Strip per repo .git suffix from generated index --- 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("", 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("", fp); xmlencode(fp, description, strlen(description)); fputs("", fp);