In a future commit, we want to possibly be able to continue the reflog message on the same line without breaking the line. As a result, when `oneline == 1`, strip any trailing new lines. Add these missing newlines back in show_log(). Signed-off-by: Denton Liu <liu.denton@xxxxxxxxx> --- log-tree.c | 4 +++- reflog-walk.c | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/log-tree.c b/log-tree.c index 923a299e70..4a7d668af6 100644 --- a/log-tree.c +++ b/log-tree.c @@ -661,8 +661,10 @@ void show_log(struct rev_info *opt) opt->commit_format == CMIT_FMT_ONELINE, &opt->date_mode, opt->date_mode_explicit); - if (opt->commit_format == CMIT_FMT_ONELINE) + if (opt->commit_format == CMIT_FMT_ONELINE) { + putc('\n', opt->diffopt.file); return; + } } } diff --git a/reflog-walk.c b/reflog-walk.c index 3a25b27d8f..e2b4c0b290 100644 --- a/reflog-walk.c +++ b/reflog-walk.c @@ -285,7 +285,11 @@ void show_reflog_message(struct reflog_walk_info *reflog_info, int oneline, info = &commit_reflog->reflogs->items[commit_reflog->recno+1]; get_reflog_selector(&selector, reflog_info, dmode, force_date, 0); if (oneline) { - printf("%s: %s", selector.buf, info->message); + struct strbuf message = STRBUF_INIT; + strbuf_addstr(&message, info->message); + strbuf_trim_trailing_newline(&message); + printf("%s: %s", selector.buf, message.buf); + strbuf_release(&message); } else { printf("Reflog: %s (%s)\nReflog message: %s", -- 2.24.0.rc2.262.g2d07a97ef5