@matheusbsbs / matheus-bagliano / commits / bf82a15095
Fork 0

commit: do not add extra LF at the end of the summary.

The scripted version relied on the nice "auto-strip the terminating LF" behaviour shell gives to "var=$(cmd)" construct, but we have to roll that ourselves. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Dec 10, 2007 at 21:02 UTC bf82a15095ed374496c2e98b6b672aa8c8c4d034
1 file changed +7 -3
builtin-commit.c
+7 -3
@@ -660,12 +660,16 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
660 rev.verbose_header = 1;
661 rev.show_root_diff = 1;
662 rev.commit_format = get_commit_format("format:%h: %s");
663 - rev.always_show_header = 1;
663 + rev.always_show_header = 0;
664
665 printf("Created %scommit ", initial_commit ? "initial " : "");
666
667 - log_tree_commit(&rev, commit);
668 - printf("\n");
667 + if (!log_tree_commit(&rev, commit)) {
668 + struct strbuf buf = STRBUF_INIT;
669 + format_commit_message(commit, "%h: %s", &buf);
670 + printf("%s\n", buf.buf);
671 + strbuf_release(&buf);
672 + }
673 }
674
675 int git_commit_config(const char *k, const char *v)