Skip to content

Commit bf82a15

Browse files
committed
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>
1 parent be15f50 commit bf82a15

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

builtin-commit.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -660,12 +660,16 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
660660
rev.verbose_header = 1;
661661
rev.show_root_diff = 1;
662662
rev.commit_format = get_commit_format("format:%h: %s");
663-
rev.always_show_header = 1;
663+
rev.always_show_header = 0;
664664

665665
printf("Created %scommit ", initial_commit ? "initial " : "");
666666

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+
}
669673
}
670674

671675
int git_commit_config(const char *k, const char *v)

0 commit comments

Comments
 (0)