summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: eab144a)
raw | patch | inline | side by side (parent: eab144a)
author | Linus Torvalds <torvalds@osdl.org> | |
Tue, 18 Apr 2006 00:43:40 +0000 (17:43 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 18 Apr 2006 04:44:33 +0000 (21:44 -0700) |
This option is very special, since pretty_print_commit() will _remove_
the newline at the end of it, so we want to have an extra separator
between the things.
I added a honking big comment this time, so that (a) I don't forget this
_again_ (I broke "oneline" several times during this printout cleanup),
and so that people can understand _why_ the code does what it does.
Now, arguably the alternate fix is to always have the '\n' at the end in
pretty-print-commit, but git-rev-list depends on the current behaviour
(but we could have git-rev-list remove it, whatever).
With the big comment, the code hopefully doesn't get broken again. And now
things like
git log --pretty=oneline --cc --patch-with-stat
works (even if that is admittedly a totally insane combination: if you
want the patch, having the "oneline" log format is just crazy, but hey,
it _works_. Even insane people are people).
Signed-off-by: Junio C Hamano <junkio@cox.net>
the newline at the end of it, so we want to have an extra separator
between the things.
I added a honking big comment this time, so that (a) I don't forget this
_again_ (I broke "oneline" several times during this printout cleanup),
and so that people can understand _why_ the code does what it does.
Now, arguably the alternate fix is to always have the '\n' at the end in
pretty-print-commit, but git-rev-list depends on the current behaviour
(but we could have git-rev-list remove it, whatever).
With the big comment, the code hopefully doesn't get broken again. And now
things like
git log --pretty=oneline --cc --patch-with-stat
works (even if that is admittedly a totally insane combination: if you
want the patch, having the "oneline" log format is just crazy, but hey,
it _works_. Even insane people are people).
Signed-off-by: Junio C Hamano <junkio@cox.net>
log-tree.c | patch | blob | history |
diff --git a/log-tree.c b/log-tree.c
index 9e5416427a38359078ab35902bad2e7cffac2a0b..9634c4677f84e7d88965b47b5af32f23668b2142 100644 (file)
--- a/log-tree.c
+++ b/log-tree.c
struct commit *commit = log->commit, *parent = log->parent;
int abbrev = opt->diffopt.abbrev;
int abbrev_commit = opt->abbrev_commit ? opt->abbrev : 40;
+ const char *extra;
int len;
opt->loginfo = NULL;
}
/*
- * Whitespace between commit messages, unless we are oneline
+ * The "oneline" format has several special cases:
+ * - The pretty-printed commit lacks a newline at the end
+ * of the buffer, but we do want to make sure that we
+ * have a newline there. If the separator isn't already
+ * a newline, add an extra one.
+ * - unlike other log messages, the one-line format does
+ * not have an empty line between entries.
*/
+ extra = "";
+ if (*sep != '\n' && opt->commit_format == CMIT_FMT_ONELINE)
+ extra = "\n";
if (opt->shown_one && opt->commit_format != CMIT_FMT_ONELINE)
putchar('\n');
opt->shown_one = 1;
* And then the pretty-printed message itself
*/
len = pretty_print_commit(opt->commit_format, commit, ~0u, this_header, sizeof(this_header), abbrev);
- printf("%s%s", this_header, sep);
+ printf("%s%s%s", this_header, extra, sep);
}
int log_tree_diff_flush(struct rev_info *opt)