From: Patrick Steinhardt Date: Fri, 23 Aug 2024 14:12:46 +0000 (+0200) Subject: reftable/stack: fix broken refnames in `write_n_ref_tables()` X-Git-Tag: v2.47.0-rc0~75^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4ac2fd9b4aabe72f8bc652b71d2fcd9d952e8093;p=thirdparty%2Fgit.git reftable/stack: fix broken refnames in `write_n_ref_tables()` The `write_n_ref_tables()` helper function writes N references in separate tables. We never reset the computed name of those references though, leading us to end up with unexpected names. Fix this by resetting the buffer. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- diff --git a/reftable/stack_test.c b/reftable/stack_test.c index 42044ed8a3..de0669b7b8 100644 --- a/reftable/stack_test.c +++ b/reftable/stack_test.c @@ -125,6 +125,7 @@ static void write_n_ref_tables(struct reftable_stack *st, .value_type = REFTABLE_REF_VAL1, }; + strbuf_reset(&buf); strbuf_addf(&buf, "refs/heads/branch-%04u", (unsigned) i); ref.refname = buf.buf; set_test_hash(ref.value.val1, i);