escape commit msg, dont indent it
1 files changed, 7 insertions(+), 19 deletions(-) | |||
---|---|---|---|
M | urmoms.c | +7 | -19 |
1@@ -161,7 +161,7 @@ printcommit(FILE *fp, git_commit *commit)
2 const git_signature *sig;
3 char buf[GIT_OID_HEXSZ + 1];
4 int i, count;
5- const char *scan, *eol;
6+ const char *msg;
7
8 /* TODO: show tag when commit has it */
9 git_oid_tostr(buf, sizeof(buf), git_commit_id(commit));
10@@ -194,13 +194,8 @@ printcommit(FILE *fp, git_commit *commit)
11 }
12 fputc('\n', fp);
13
14- for (scan = git_commit_message(commit); scan && *scan;) {
15- for (eol = scan; *eol && *eol != '\n'; ++eol) /* find eol */
16- ;
17-
18- fprintf(fp, " %.*s\n", (int) (eol - scan), scan);
19- scan = *eol ? eol + 1 : NULL;
20- }
21+ if ((msg = git_commit_message(commit)))
22+ xmlencode(fp, msg, strlen(msg));
23 fputc('\n', fp);
24 }
25
26@@ -243,7 +238,6 @@ printshowfile(git_commit *commit)
27 if (!git_diff_get_stats(&diffstats, diff)) {
28 if (!git_diff_stats_to_buf(&diffstatsbuf, diffstats,
29 GIT_DIFF_STATS_FULL | GIT_DIFF_STATS_SHORT, 80)) {
30- fputs("<hr/>", fp);
31 fprintf(fp, "Diffstat:\n");
32 fputs(diffstatsbuf.ptr, fp);
33 }
34@@ -405,7 +399,7 @@ printcommitatom(FILE *fp, git_commit *commit)
35 const git_signature *sig;
36 char buf[GIT_OID_HEXSZ + 1];
37 int i, count;
38- const char *scan, *eol, *summary;
39+ const char *msg, *summary;
40
41 fputs("<entry>\n", fp);
42
43@@ -451,15 +445,9 @@ printcommitatom(FILE *fp, git_commit *commit)
44 }
45 fputc('\n', fp);
46
47- for (scan = git_commit_message(commit); scan && *scan;) {
48- for (eol = scan; *eol && *eol != '\n'; ++eol) /* find eol */
49- ;
50-
51- fprintf(fp, " %.*s\n", (int) (eol - scan), scan);
52- scan = *eol ? eol + 1 : NULL;
53- }
54- fputc('\n', fp);
55- fputs("</content>\n", fp);
56+ if ((msg = git_commit_message(commit)))
57+ xmlencode(fp, msg, strlen(msg));
58+ fputs("\n</content>\n", fp);
59 if (sig) {
60 fputs("<author><name>", fp);
61 xmlencode(fp, sig->name, strlen(sig->name));