summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 046aa64)
raw | patch | inline | side by side (parent: 046aa64)
author | Junio C Hamano <junkio@cox.net> | |
Mon, 23 May 2005 19:07:55 +0000 (12:07 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Mon, 23 May 2005 19:17:09 +0000 (12:17 -0700) |
Thomas Glanzmann noticed that diff-tree -z HEAD piped to
diff-helper -z did not work. Since diff-helper -z expects NUL
terminated lines, we should generate such.
The output side of the diff-helper should always be using '\n'
termination; earlier it used the same line_termination used for
the input side, which was a mistake.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
diff-helper -z did not work. Since diff-helper -z expects NUL
terminated lines, we should generate such.
The output side of the diff-helper should always be using '\n'
termination; earlier it used the same line_termination used for
the input side, which was a mistake.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
diff-helper.c | patch | blob | history | |
diff-tree.c | patch | blob | history |
diff --git a/diff-helper.c b/diff-helper.c
index 23855759eebc649e7dcc03b6fb3abae3064bb5ed..c977a1b8596587995f2ea24c6152ffcb5f3773a1 100644 (file)
--- a/diff-helper.c
+++ b/diff-helper.c
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 0fd28f12883e7e99d73d3b35f536e8168a366c06..2ec0d6fa81e083f0e9dcbda17ce0b1b9a9e1f4fc 100644 (file)
--- a/diff-tree.c
+++ b/diff-tree.c
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);