@@ -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;
+ }
}
}
@@ -285,9 +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);
- }
- else {
+ int len = strlen(info->message);
+ if (len > 0)
+ len--; /* strip away trailing newline */
+ printf("%s: %.*s", selector.buf, len, info->message);
+ } else {
printf("Reflog: %s (%s)\nReflog message: %s",
selector.buf, info->email, info->message);
}
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(). While we're at it, cuddle the else with the closing brace of the if to more closely match the existing style. Signed-off-by: Denton Liu <liu.denton@gmail.com> --- log-tree.c | 4 +++- reflog-walk.c | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-)