summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-12-15 09:39:48 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-12-15 09:39:49 -0800
commit250ca49b4f3ee0781a98c47f4515ae597ca3dbab (patch)
tree098f5771954d02fa7803fa51c5c803825f294cfa /builtin
parentMerge branch 'rj/receive-pack-avoid-sigpipe-during-status-reporting' (diff)
parentrefs/debug: trim trailing LF from reflog message (diff)
downloadtgif-250ca49b4f3ee0781a98c47f4515ae597ca3dbab.tar.xz
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.c12
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)),