X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=diff-tree.c;h=2ec0d6fa81e083f0e9dcbda17ce0b1b9a9e1f4fc;hb=5831b563a442e7c3198a444a51d8caba4d072506;hp=0b629d20b36f283b70751963bb4fcf5571f28641;hpb=6b14d7faf0bad026a81a27bac07b47691f621b8f;p=git.git diff --git a/diff-tree.c b/diff-tree.c index 0b629d20..2ec0d6fa 100644 --- a/diff-tree.c +++ b/diff-tree.c @@ -262,7 +262,7 @@ static void call_diff_setup(void) diff_setup(reverse_diff); } -static int call_diff_flush() +static int call_diff_flush(void) { if (detect_rename) diffcore_rename(detect_rename, diff_score_opt); @@ -277,7 +277,18 @@ static int call_diff_flush() 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);