summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-27 17:22:09 (GMT)
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-27 17:22:09 (GMT)
commit84c1afd7e7c69c6c3c0677d5ee01925d4c70d318 (patch)
tree2f37f7b43445584e19bd3332fff898aa02d6fc8d
parenta9c9cef161b26ca610783dd0b180d18956c7b119 (diff)
downloadgit-84c1afd7e7c69c6c3c0677d5ee01925d4c70d318.zip
git-84c1afd7e7c69c6c3c0677d5ee01925d4c70d318.tar.gz
git-84c1afd7e7c69c6c3c0677d5ee01925d4c70d318.tar.bz2
git-diff-tree: simplify header output with '-z'
No need to make them multiple lines, in fact we explicitly don't want that. This also fixes a 64-bit problem pointed out by Markus F.X.J. Oberhumer, where we gave "%.*s" a "ptrdiff_t" length argument instead of an "int".
-rw-r--r--diff-tree.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/diff-tree.c b/diff-tree.c
index 8297b7f..80d02b4 100644
--- a/diff-tree.c
+++ b/diff-tree.c
@@ -269,18 +269,11 @@ static int call_diff_flush(void)
return 0;
}
if (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);
- }
+ const char *fmt = "%s";
+ if (diff_output_format == DIFF_FORMAT_MACHINE)
+ fmt = "%s%c";
+
+ printf(fmt, header, 0);
header = NULL;
}
diff_flush(diff_output_format, 1);