diff options
author | René Scharfe <l.s.r@web.de> | 2024-03-24 17:40:00 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-03-25 20:03:27 +0100 |
commit | 4d45e79e115ef3259179032367cb84d08198c6c5 (patch) | |
tree | bfa9e30688a0011ac49fe24b319d89303af5a5a6 /midx.c | |
parent | The tenth batch (diff) | |
download | git-4d45e79e115ef3259179032367cb84d08198c6c5.tar.xz git-4d45e79e115ef3259179032367cb84d08198c6c5.zip |
midx: use strvec_pushf() for pack-objects base name
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>
Reviewed-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'midx.c')
-rw-r--r-- | midx.c | 7 |
1 files changed, 1 insertions, 6 deletions
@@ -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; |