summaryrefslogtreecommitdiff
path: root/t/helper
diff options
context:
space:
mode:
authorLibravatar Han-Wen Nienhuys <hanwen@google.com>2021-12-02 17:36:32 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-12-02 11:14:08 -0800
commit3474b602a5387df459a25c3e35747c11f1b08da7 (patch)
treec3f35510edb7155f3ac9d8795a8cce654ebb9471 /t/helper
parentt1405: check for_each_reflog_ent_reverse() more thoroughly (diff)
downloadtgif-3474b602a5387df459a25c3e35747c11f1b08da7.tar.xz
test-ref-store: tweaks to for-each-reflog-ent format
We have some tests that read from files in .git/logs/ hierarchy when checking if correct reflog entries are created, but that is too specific to the files backend. Other backends like reftable may not store its reflog entries in such a "one line per entry" format. Update for-each-reflog-ent test helper to produce output that is identical to lines in a reflog file files backend uses. That way, (1) the current tests can be updated to use the test helper to read the reflog entries instead of (parts of) reflog files, and perform the same inspection for correctness, and (2) when the ref backend is swapped to another backend, the updated test can be used as-is to check the correctness. Adapt t1400 to use the for-each-reflog-ent test helper. Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/helper')
-rw-r--r--t/helper/test-ref-store.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c
index 5ac33dfb59..775e5da5b9 100644
--- a/t/helper/test-ref-store.c
+++ b/t/helper/test-ref-store.c
@@ -152,8 +152,9 @@ static int each_reflog(struct object_id *old_oid, struct object_id *new_oid,
const char *committer, timestamp_t timestamp,
int tz, const char *msg, void *cb_data)
{
- printf("%s %s %s %" PRItime " %d %s", oid_to_hex(old_oid),
- oid_to_hex(new_oid), committer, timestamp, tz, msg);
+ printf("%s %s %s %" PRItime " %+05d%s%s", oid_to_hex(old_oid),
+ oid_to_hex(new_oid), committer, timestamp, tz,
+ *msg == '\n' ? "" : "\t", msg);
return 0;
}