[PATCH v2 06/10] reftable/stack: fix broken refnames in `write_n_ref_tables()`
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Aug 23, 2024, 14:12 UTC
- Message-ID
- <e3b28709b5fd525b95c6f296e5b2920561d9a8a3.1724420744.git.ps@pks.im>
- In-Reply-To
- <cover.1724420744.git.ps@pks.im>
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> --- reftable/stack_test.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/reftable/stack_test.c b/reftable/stack_test.c index 42044ed8a3e..de0669b7b8a 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);
-- 2.46.0.164.g477ce5ccd6.dirty