diff options
-rw-r--r-- | diff-helper.c | 2 | ||||
-rw-r--r-- | diff-tree.c | 13 |
2 files changed, 13 insertions, 2 deletions
diff --git a/diff-helper.c b/diff-helper.c index 23855759ee..c977a1b859 100644 --- a/diff-helper.c +++ b/diff-helper.c @@ -121,7 +121,7 @@ int main(int ac, const char **av) { if (status) { unrecognized: diff_flush(diff_output_style); - printf("%s%c", sb1.buf, line_termination); + printf("%s\n", sb1.buf); } } if (detect_rename) diff --git a/diff-tree.c b/diff-tree.c index 0fd28f1288..2ec0d6fa81 100644 --- a/diff-tree.c +++ b/diff-tree.c @@ -277,7 +277,18 @@ static int call_diff_flush(void) if (nr_paths) diffcore_pathspec(paths); if (header) { - printf("%s", header); + if (diff_output_format == DIFF_FORMAT_MACHINE) { + const char *ep, *cp; + for (cp = header; *cp; cp = ep) { + ep = strchr(cp, '\n'); + if (ep == 0) ep = cp + strlen(cp); + printf("%.*s%c", ep-cp, cp, 0); + if (*ep) ep++; + } + } + else { + printf("%s", header); + } header = NULL; } diff_flush(diff_output_format); |