git-query

git data extraction tool using c and libgit2

git clone https://9o.is/git/git-query.git

commit a6b55dcf5714f390eff69e79c640a1850ae73f2a
parent b7825efbe7aec6c4cd0e16bd265938af81542e83
Author: sin <sin@2f30.org>
Date:   Wed,  6 Jan 2016 14:46:40 +0000

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

Diffstat:
Mstagit-index.c | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git 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);