Jeff King <peff@xxxxxxxx> writes: > Perhaps it would be even more readable to simply split the printing of > the commit message and the diff. Tracking this bug was a bit confusing. > Ideally, print_summary would just say: > > print_commit_message(commit); > print_diff(commit, "^commit"); > > where obviously each of those takes a few lines to say properly. But the > use of a combination "show the log and maybe the diff" function seems > like a shell holdover, trying to avoid spawning too many processes. Perhaps, but that's post 1.5.4. There is no short-hand to call the single commit diff-tree and not give any commit header afair. Anyway, format-commit-message() makes it much more readable ;-) diff --git a/builtin-commit.c b/builtin-commit.c index b6b81d5..9cb7589 100644 --- a/builtin-commit.c +++ b/builtin-commit.c @@ -660,12 +660,16 @@ static void print_summary(const char *prefix, const unsigned char *sha1) rev.verbose_header = 1; rev.show_root_diff = 1; rev.commit_format = get_commit_format("format:%h: %s"); - rev.always_show_header = 1; + rev.always_show_header = 0; printf("Created %scommit ", initial_commit ? "initial " : ""); - log_tree_commit(&rev, commit); - printf("\n"); + if (!log_tree_commit(&rev, commit)) { + struct strbuf buf = STRBUF_INIT; + format_commit_message(commit, "%h: %s", &buf); + printf("%s\n", buf.buf); + strbuf_release(&buf); + } } int git_commit_config(const char *k, const char *v) - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html