git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Cc: Jeff King <peff@peff.net>, karthik nayak <karthik.188@gmail.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: [PATCH v2 06/10] reftable/stack: fix broken refnames in `write_n_ref_tables()`
Date: Fri, 23 Aug 2024 16:12:46 +0200	[thread overview]
Message-ID: <e3b28709b5fd525b95c6f296e5b2920561d9a8a3.1724420744.git.ps@pks.im> (raw)
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


  parent reply	other threads:[~2024-08-23 14:12 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-19 15:39 [PATCH 00/10] reftable: fix reload with active iterators Patrick Steinhardt
2024-08-19 15:39 ` [PATCH 01/10] reftable/blocksource: drop malloc block source Patrick Steinhardt
2024-08-19 15:39 ` [PATCH 02/10] reftable/stack: inline `stack_compact_range_stats()` Patrick Steinhardt
2024-08-22  8:23   ` karthik nayak
2024-08-19 15:39 ` [PATCH 03/10] reftable/reader: rename `reftable_new_reader()` Patrick Steinhardt
2024-08-22 18:51   ` Justin Tobler
2024-08-22 19:09     ` Junio C Hamano
2024-08-23  5:22       ` Patrick Steinhardt
2024-08-19 15:39 ` [PATCH 04/10] reftable/reader: inline `init_reader()` Patrick Steinhardt
2024-08-19 15:39 ` [PATCH 05/10] reftable/reader: inline `reader_close()` Patrick Steinhardt
2024-08-19 15:40 ` [PATCH 06/10] reftable/stack: fix broken refnames in `write_n_ref_tables()` Patrick Steinhardt
2024-08-19 15:40 ` [PATCH 07/10] reftable/reader: introduce refcounting Patrick Steinhardt
2024-08-22  9:47   ` karthik nayak
2024-08-22 11:35     ` Patrick Steinhardt
2024-08-23 10:14       ` karthik nayak
2024-08-19 15:40 ` [PATCH 08/10] reftable/reader: keep readers alive during iteration Patrick Steinhardt
2024-08-23 10:21   ` karthik nayak
2024-08-23 13:42     ` Patrick Steinhardt
2024-08-19 15:40 ` [PATCH 09/10] reftable/stack: reorder swapping in the reloaded stack contents Patrick Steinhardt
2024-08-19 15:40 ` [PATCH 10/10] reftable/stack: fix segfault when reload with reused readers fails Patrick Steinhardt
2024-08-22  8:13 ` [PATCH 00/10] reftable: fix reload with active iterators karthik nayak
2024-08-22 12:41 ` Jeff King
2024-08-22 12:53   ` Patrick Steinhardt
2024-08-22 15:15     ` Junio C Hamano
2024-08-23  5:23       ` Patrick Steinhardt
2024-08-22 15:11   ` Junio C Hamano
2024-08-23 14:12 ` [PATCH v2 " Patrick Steinhardt
2024-08-23 14:12   ` [PATCH v2 01/10] reftable/blocksource: drop malloc block source Patrick Steinhardt
2024-08-23 14:12   ` [PATCH v2 02/10] reftable/stack: inline `stack_compact_range_stats()` Patrick Steinhardt
2024-08-23 14:12   ` [PATCH v2 03/10] reftable/reader: rename `reftable_new_reader()` Patrick Steinhardt
2024-08-23 14:12   ` [PATCH v2 04/10] reftable/reader: inline `init_reader()` Patrick Steinhardt
2024-08-23 14:12   ` [PATCH v2 05/10] reftable/reader: inline `reader_close()` Patrick Steinhardt
2024-08-23 14:12   ` Patrick Steinhardt [this message]
2024-08-23 14:12   ` [PATCH v2 07/10] reftable/reader: introduce refcounting Patrick Steinhardt
2024-08-23 14:12   ` [PATCH v2 08/10] reftable/reader: keep readers alive during iteration Patrick Steinhardt
2024-08-23 14:12   ` [PATCH v2 09/10] reftable/stack: reorder swapping in the reloaded stack contents Patrick Steinhardt
2024-08-23 14:12   ` [PATCH v2 10/10] reftable/stack: fix segfault when reload with reused readers fails Patrick Steinhardt
2024-08-23 16:49   ` [PATCH v2 00/10] reftable: fix reload with active iterators Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e3b28709b5fd525b95c6f296e5b2920561d9a8a3.1724420744.git.ps@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=karthik.188@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).