From: Taylor Blau <me@ttaylorr.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
Elijah Newren <newren@gmail.com>, Patrick Steinhardt <ps@pks.im>
Subject: Re: [RFC PATCH 02/14] strvec: introduce `strvec_init_alloc()`
Date: Thu, 26 Feb 2026 22:07:12 -0500 [thread overview]
Message-ID: <aaEKYGWi7nd1VLJc@nand.local> (raw)
In-Reply-To: <xmqq4in3xlvb.fsf@gitster.g>
On Thu, Feb 26, 2026 at 12:58:48PM -0800, Junio C Hamano wrote:
> > It is not satisifying that strvec_init() does *not* become a thin
> > wrapper around this that says "my initial allocation is for zero
> > elements", but that cannot be done easily as a strvec that begins as
> > an empty one has a small optimization to avoid one-slot allocation
> > only to store NULL. So, ... OK.
>
> Actually, we should do the same optimization if a caller explicitly
> asks
>
> strvec_init_alloc(&array, 0);
>
> So perhaps we could do this if we wanted to encapsulate the tricky
> bits in a single place for maintainability.
Ah, that is a very satisfying change. I like it and squashed it into my
series with your:
Helped-by: Junio C Hamano <gitster@pobox.com>
> void strvec_init(struct strvec *array)
> {
> - struct strvec blank = STRVEC_INIT;
> - memcpy(array, &blank, sizeof(*array));
> + strvec_init(array, 0);
I suspect you meant `strvec_init_alloc()` here and not `strvec_init()`,
but I applied the change and adjusted the typo before squashing it in.
Thanks,
Taylor
next prev parent reply other threads:[~2026-02-27 3:07 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 0:20 [RFC PATCH 00/14] repack: incremental MIDX/bitmap-based repacking Taylor Blau
2026-02-25 0:20 ` [RFC PATCH 06/14] repack: track the ODB source via existing_packs Taylor Blau
2026-02-25 0:21 ` Taylor Blau
2026-02-25 0:23 ` Taylor Blau
2026-02-25 0:20 ` [RFC PATCH 01/14] midx: use `string_list` for retained MIDX files Taylor Blau
2026-02-26 20:29 ` Junio C Hamano
2026-02-27 3:02 ` Taylor Blau
2026-02-25 0:21 ` [RFC PATCH 02/14] strvec: introduce `strvec_init_alloc()` Taylor Blau
2026-02-26 20:34 ` Junio C Hamano
2026-02-26 20:58 ` Junio C Hamano
2026-02-27 3:07 ` Taylor Blau [this message]
2026-02-25 0:21 ` [RFC PATCH 03/14] midx: use `strvec` for `keep_hashes` Taylor Blau
2026-02-25 0:21 ` [RFC PATCH 04/14] midx: introduce `--checksum-only` for incremental MIDX writes Taylor Blau
2026-02-25 0:21 ` [RFC PATCH 05/14] midx: support custom `--base` " Taylor Blau
2026-02-25 0:21 ` [RFC PATCH 07/14] midx: expose `midx_layer_contains_pack()` Taylor Blau
2026-02-25 0:21 ` [RFC PATCH 08/14] repack-midx: factor out `repack_prepare_midx_command()` Taylor Blau
2026-02-25 0:21 ` [RFC PATCH 09/14] repack-midx: extract `repack_fill_midx_stdin_packs()` Taylor Blau
2026-02-25 0:21 ` [RFC PATCH 10/14] repack-geometry: prepare for incremental MIDX repacking Taylor Blau
2026-02-25 0:21 ` [RFC PATCH 11/14] builtin/repack.c: convert `--write-midx` to an `OPT_CALLBACK` Taylor Blau
2026-02-25 0:21 ` [RFC PATCH 12/14] repack: implement incremental MIDX repacking Taylor Blau
2026-02-25 0:22 ` [RFC PATCH 13/14] repack: introduce `--write-midx=incremental` Taylor Blau
2026-02-25 0:22 ` [RFC PATCH 14/14] repack: allow `--write-midx=incremental` without `--geometric` Taylor Blau
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=aaEKYGWi7nd1VLJc@nand.local \
--to=me@ttaylorr.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=newren@gmail.com \
--cc=peff@peff.net \
--cc=ps@pks.im \
/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