Subject: Re: [PATCH 3/9] t/helper: add 'find-pack' test-tool

From: Junio C Hamano <[email-masked]>
Date: Thu, 15 Jun 2023 16:32:35 -0700

Christian Couder <[email-masked]> writes:

> In a following commit, we will make it possible to separate objects in
> different packfiles depending on a filter.
>
> To make sure that the right objects are in the right packs, let's add a
> new test-tool that can display which packfile(s) a given object is in.

This tool would be serviceable if we only are interested in checking
just a few objects, but if we were to check many objects, I have to
wonder if it would be more efficient to use show-index to dump the
list of objects per pack, which should be sorted by object name, so
it should be trivial to run "comm" with the list of objects you want
to check.

Or if you only are checking about a dozen or so, taking one or more
arguments from the command line and looping over them may also be
OK.  The output format of course may have to be changed, if we were
to go that route, though.

It really depends on the granularity at which this test helper wants
to work at, I think.

Anyway...

> diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
> index abe8a785eb..41da40c296 100644
> --- a/t/helper/test-tool.c
> +++ b/t/helper/test-tool.c
> @@ -31,6 +31,7 @@ static struct test_cmd cmds[] = {
>  	{ "env-helper", cmd__env_helper },
>  	{ "example-decorate", cmd__example_decorate },
>  	{ "fast-rebase", cmd__fast_rebase },
> +	{ "find-pack", cmd__find_pack },
>  	{ "fsmonitor-client", cmd__fsmonitor_client },
>  	{ "genrandom", cmd__genrandom },
>  	{ "genzeros", cmd__genzeros },
> diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
> index ea2672436c..411dbf2db4 100644
> --- a/t/helper/test-tool.h
> +++ b/t/helper/test-tool.h
> @@ -25,6 +25,7 @@ int cmd__dump_reftable(int argc, const char **argv);
>  int cmd__env_helper(int argc, const char **argv);
>  int cmd__example_decorate(int argc, const char **argv);
>  int cmd__fast_rebase(int argc, const char **argv);
> +int cmd__find_pack(int argc, const char **argv);
>  int cmd__fsmonitor_client(int argc, const char **argv);
>  int cmd__genrandom(int argc, const char **argv);
>  int cmd__genzeros(int argc, const char **argv);