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 <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Aug 23, 2024 at 16:12 UTC 4ac2fd9b4aabe72f8bc652b71d2fcd9d952e8093
1 file changed +1
reftable/stack_test.c
+1
@@ -125,6 +125,7 @@ static void write_n_ref_tables(struct reftable_stack *st,
125 .value_type = REFTABLE_REF_VAL1,
126 };
127
128 + strbuf_reset(&buf);
129 strbuf_addf(&buf, "refs/heads/branch-%04u", (unsigned) i);
130 ref.refname = buf.buf;
131 set_test_hash(ref.value.val1, i);