]> git.ipfire.org Git - thirdparty/git.git/commitdiff
reftable/stack: fix broken refnames in `write_n_ref_tables()`
authorPatrick Steinhardt <ps@pks.im>
Fri, 23 Aug 2024 14:12:46 +0000 (16:12 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 23 Aug 2024 15:04:47 +0000 (08:04 -0700)
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>
reftable/stack_test.c

index 42044ed8a3eb17e75629f65857ab0147222d7df5..de0669b7b8a956109081e6f37a3fd70411ed2af8 100644 (file)
@@ -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);