aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2025-10-15 18:27:41 -0400
committerJunio C Hamano <gitster@pobox.com>2025-10-16 10:08:53 -0700
commitc660b0dbcbb70647f5103a4573963397522a1f0f (patch)
tree006284a4a35c5deebaa1ded7198c91d3c3bc25df
parentbuiltin/repack: avoid "the_hash_algo" in `repack_promisor_objects()` (diff)
downloadgit-c660b0dbcbb70647f5103a4573963397522a1f0f.tar.gz
git-c660b0dbcbb70647f5103a4573963397522a1f0f.zip
builtin/repack.c: avoid "the_hash_algo" in `finish_pack_objects_cmd()`
In a similar spirit as previous commits, avoid referring directly to "the_hash_algo" in builtin/repack.c::finish_pack_objects_cmd() and instead accept one as a parameter to the function. Since this function has a number of callers throughout the builtin, the diff is a little noisier than previous commits. However, each hunk is limited to passing the hash_algo parameter from a repository pointer that is already in scope. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/repack.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/builtin/repack.c b/builtin/repack.c
index a7e94ed03c..a043704aa8 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -1073,7 +1073,8 @@ static void remove_redundant_bitmaps(struct string_list *include,
strbuf_release(&path);
}
-static int finish_pack_objects_cmd(struct child_process *cmd,
+static int finish_pack_objects_cmd(const struct git_hash_algo *algop,
+ struct child_process *cmd,
struct string_list *names,
int local)
{
@@ -1084,7 +1085,7 @@ static int finish_pack_objects_cmd(struct child_process *cmd,
while (strbuf_getline_lf(&line, out) != EOF) {
struct string_list_item *item;
- if (line.len != the_hash_algo->hexsz)
+ if (line.len != algop->hexsz)
die(_("repack: Expecting full hex object ID lines only "
"from pack-objects."));
/*
@@ -1150,7 +1151,8 @@ static int write_filtered_pack(const struct pack_objects_args *args,
fprintf(in, "%s%s.pack\n", caret, item->string);
fclose(in);
- return finish_pack_objects_cmd(&cmd, names, local);
+ return finish_pack_objects_cmd(existing->repo->hash_algo, &cmd, names,
+ local);
}
static void combine_small_cruft_packs(FILE *in, size_t combine_cruft_below_size,
@@ -1247,7 +1249,8 @@ static int write_cruft_pack(const struct pack_objects_args *args,
fprintf(in, "%s.pack\n", item->string);
fclose(in);
- return finish_pack_objects_cmd(&cmd, names, local);
+ return finish_pack_objects_cmd(existing->repo->hash_algo, &cmd, names,
+ local);
}
static const char *find_pack_prefix(const char *packdir, const char *packtmp)
@@ -1534,7 +1537,7 @@ int cmd_repack(int argc,
fclose(in);
}
- ret = finish_pack_objects_cmd(&cmd, &names, 1);
+ ret = finish_pack_objects_cmd(repo->hash_algo, &cmd, &names, 1);
if (ret)
goto cleanup;