Skip to content

Commit 4d45e79

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Reviewed-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 11c821f commit 4d45e79

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

midx.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2163,7 +2163,6 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size,
21632163
unsigned char *include_pack;
21642164
struct child_process cmd = CHILD_PROCESS_INIT;
21652165
FILE *cmd_in;
2166-
struct strbuf base_name = STRBUF_INIT;
21672166
struct multi_pack_index *m = lookup_multi_pack_index(r, object_dir);
21682167

21692168
/*
@@ -2190,9 +2189,7 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size,
21902189

21912190
strvec_push(&cmd.args, "pack-objects");
21922191

2193-
strbuf_addstr(&base_name, object_dir);
2194-
strbuf_addstr(&base_name, "/pack/pack");
2195-
strvec_push(&cmd.args, base_name.buf);
2192+
strvec_pushf(&cmd.args, "%s/pack/pack", object_dir);
21962193

21972194
if (delta_base_offset)
21982195
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,
22042201
else
22052202
strvec_push(&cmd.args, "-q");
22062203

2207-
strbuf_release(&base_name);
2208-
22092204
cmd.git_cmd = 1;
22102205
cmd.in = cmd.out = -1;
22112206

0 commit comments

Comments
 (0)