diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2016-01-06 20:00:38 +0100 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2016-01-06 20:06:06 +0100 |
commit | ede4982f67f54904a1be6de77c6db033d56b0a34 (patch) | |
tree | e61fb49ecce8d676a489f1c6db4da7fb99438ffc /stagit-index.c | |
parent | db02820a175c43cf1c225928bc09dd3fd5d93d71 (diff) |
strip .git suffix from name
also free stripped_name in the case of stagit-index
Diffstat (limited to 'stagit-index.c')
-rw-r--r-- | stagit-index.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/stagit-index.c b/stagit-index.c index e765732..3e546f8 100644 --- a/stagit-index.c +++ b/stagit-index.c @@ -118,13 +118,13 @@ writeheader(FILE *fp) int writefooter(FILE *fp) { - return !fputs("</tbody></table></div></body>\n</html>", fp); + return !fputs("</tbody>\n</table>\n</div>\n</body>\n</html>\n", fp); } int writelog(FILE *fp) { - char *stripped_name, *p; + char *stripped_name = NULL, *p; git_commit *commit = NULL; const git_signature *author; git_revwalk *w = NULL; @@ -144,18 +144,17 @@ writelog(FILE *fp) author = git_commit_author(commit); - fputs("<tr><td><a href=\"", fp); - xmlencode(fp, name, strlen(name)); - fputs("/log.html\">", fp); - /* strip .git suffix */ if (!(stripped_name = strdup(name))) err(1, "strdup"); if ((p = strrchr(stripped_name, '.'))) if (!strcmp(p, ".git")) *p = '\0'; - xmlencode(fp, stripped_name, strlen(stripped_name)); + fputs("<tr><td><a href=\"", fp); + xmlencode(fp, stripped_name, strlen(stripped_name)); + fputs("/log.html\">", fp); + xmlencode(fp, stripped_name, strlen(stripped_name)); fputs("</a></td><td>", fp); xmlencode(fp, description, strlen(description)); fputs("</td><td>", fp); @@ -168,6 +167,7 @@ writelog(FILE *fp) git_commit_free(commit); err: git_revwalk_free(w); + free(stripped_name); return ret; } |