diff options
| author | Junio C Hamano <gitster@pobox.com> | 2021-12-15 09:39:48 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2021-12-15 09:39:49 -0800 |
| commit | 250ca49b4f3ee0781a98c47f4515ae597ca3dbab (patch) | |
| tree | 098f5771954d02fa7803fa51c5c803825f294cfa /builtin | |
| parent | 4f7e2f0b212132a1807448a170ddca1def234137 (diff) | |
| parent | 65279256f3d3576ff16332d7f0ee124f593cb476 (diff) | |
Merge branch 'hn/reflog-tests'
Prepare tests on ref API to help testing reftable backends.
* hn/reflog-tests:
refs/debug: trim trailing LF from reflog message
test-ref-store: tweaks to for-each-reflog-ent format
t1405: check for_each_reflog_ent_reverse() more thoroughly
test-ref-store: don't add newline to reflog message
show-branch: show reflog message
Diffstat (limited to 'builtin')
| -rw-r--r-- | builtin/show-branch.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/builtin/show-branch.c b/builtin/show-branch.c index 082449293b..f1e8318592 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -761,6 +761,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) char *logmsg; char *nth_desc; const char *msg; + char *end; timestamp_t timestamp; int tz; @@ -770,11 +771,12 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) reflog = i; break; } - msg = strchr(logmsg, '\t'); - if (!msg) - msg = "(none)"; - else - msg++; + + end = strchr(logmsg, '\n'); + if (end) + *end = '\0'; + + msg = (*logmsg == '\0') ? "(none)" : logmsg; reflog_msg[i] = xstrfmt("(%s) %s", show_date(timestamp, tz, DATE_MODE(RELATIVE)), |
