summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: aefa4a5)
raw | patch | inline | side by side (parent: aefa4a5)
author | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Thu, 23 Jun 2005 20:56:55 +0000 (13:56 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Thu, 23 Jun 2005 20:56:55 +0000 (13:56 -0700) |
diff-tree.c | patch | blob | history |
diff --git a/diff-tree.c b/diff-tree.c
index 7446e09af4f4b7a5f7475a42bb60c9818e6cc9d5..d467e6cf8d879ddc096ce8bbfabaf8dd35d359b9 100644 (file)
--- a/diff-tree.c
+++ b/diff-tree.c
return 0;
}
if (header) {
- const char *fmt = "%s";
- if (diff_output_format == DIFF_FORMAT_MACHINE)
- fmt = "%s%c";
-
- printf(fmt, header, 0);
+ printf("%s%c", header, diff_output_format == DIFF_FORMAT_MACHINE ? 0 : '\n');
header = NULL;
}
diff_flush(diff_output_format);
return retval;
}
-static char *generate_header(const char *commit, const char *parent, const char *msg, unsigned long len)
+static const char *generate_header(const char *commit, const char *parent, const char *msg, unsigned long len)
{
static char this_header[16384];
int offset;
- offset = sprintf(this_header, "%s%s (from %s)\n", header_prefix, commit, parent);
- if (verbose_header) {
- offset += pretty_print_commit(commit_format, msg, len, this_header + offset, sizeof(this_header) - offset);
- this_header[offset++] = '\n';
- this_header[offset++] = 0;
- }
+ if (!verbose_header)
+ return commit;
+ offset = sprintf(this_header, "%s%s (from %s)\n", header_prefix, commit, parent);
+ offset += pretty_print_commit(commit_format, msg, len, this_header + offset, sizeof(this_header) - offset);
return this_header;
}