git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH] midx: use strvec_pushf() for pack-objects base name
Date: Mon, 25 Mar 2024 08:38:41 +0100	[thread overview]
Message-ID: <ZgEqASsDnaovUV0T@tanuki> (raw)
In-Reply-To: <9483038c-9529-4243-9b9a-97254fac29c1@web.de>

[-- Attachment #1: Type: text/plain, Size: 1634 bytes --]

On Sun, Mar 24, 2024 at 05:40:00PM +0100, René Scharfe wrote:
> Build the pack base name argument directly using strvec_pushf() instead
> of with an intermediate strbuf.  This is shorter, simpler and avoids the
> need for explicit cleanup.
> 
> Signed-off-by: René Scharfe <l.s.r@web.de>

This patch looks obviously good to me, so please feel free to add my
Reviewed-by. Thanks!

Patrick

> ---
>  midx.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/midx.c b/midx.c
> index 85e1c2cd12..41521e019c 100644
> --- a/midx.c
> +++ b/midx.c
> @@ -2163,7 +2163,6 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size,
>  	unsigned char *include_pack;
>  	struct child_process cmd = CHILD_PROCESS_INIT;
>  	FILE *cmd_in;
> -	struct strbuf base_name = STRBUF_INIT;
>  	struct multi_pack_index *m = lookup_multi_pack_index(r, object_dir);
> 
>  	/*
> @@ -2190,9 +2189,7 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size,
> 
>  	strvec_push(&cmd.args, "pack-objects");
> 
> -	strbuf_addstr(&base_name, object_dir);
> -	strbuf_addstr(&base_name, "/pack/pack");
> -	strvec_push(&cmd.args, base_name.buf);
> +	strvec_pushf(&cmd.args, "%s/pack/pack", object_dir);
> 
>  	if (delta_base_offset)
>  		strvec_push(&cmd.args, "--delta-base-offset");
> @@ -2204,8 +2201,6 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size,
>  	else
>  		strvec_push(&cmd.args, "-q");
> 
> -	strbuf_release(&base_name);
> -
>  	cmd.git_cmd = 1;
>  	cmd.in = cmd.out = -1;
> 
> --
> 2.44.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2024-03-25  7:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-24 16:40 [PATCH] midx: use strvec_pushf() for pack-objects base name René Scharfe
2024-03-25  7:38 ` Patrick Steinhardt [this message]

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=ZgEqASsDnaovUV0T@tanuki \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    /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).