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 /refs | |
parent | Merge branch 'rj/receive-pack-avoid-sigpipe-during-status-reporting' (diff) | |
parent | refs/debug: trim trailing LF from reflog message (diff) | |
download | tgif-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 'refs')
-rw-r--r-- | refs/debug.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/refs/debug.c b/refs/debug.c index 756d07c724..791423c6a7 100644 --- a/refs/debug.c +++ b/refs/debug.c @@ -284,6 +284,7 @@ static int debug_print_reflog_ent(struct object_id *old_oid, int ret; char o[GIT_MAX_HEXSZ + 1] = "null"; char n[GIT_MAX_HEXSZ + 1] = "null"; + char *msgend = strchrnul(msg, '\n'); if (old_oid) oid_to_hex_r(o, old_oid); if (new_oid) @@ -291,8 +292,10 @@ static int debug_print_reflog_ent(struct object_id *old_oid, ret = dbg->fn(old_oid, new_oid, committer, timestamp, tz, msg, dbg->cb_data); - trace_printf_key(&trace_refs, "reflog_ent %s (ret %d): %s -> %s, %s %ld \"%s\"\n", - dbg->refname, ret, o, n, committer, (long int)timestamp, msg); + trace_printf_key(&trace_refs, + "reflog_ent %s (ret %d): %s -> %s, %s %ld \"%.*s\"\n", + dbg->refname, ret, o, n, committer, + (long int)timestamp, (int)(msgend - msg), msg); return ret; } |