summaryrefslogtreecommitdiff
path: root/refs
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 /refs
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 'refs')
-rw-r--r--refs/debug.c7
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;
}