Subject: Re: [PATCH 4/7] backfill: die on incompatible filter options

From: Junio C Hamano <[email-masked]>
Date: Mon, 04 May 2026 07:59:47 +0900

"Derrick Stolee via GitGitGadget" <[email-masked]> writes:

> From: Derrick Stolee <[email-masked]>
>
> The 'git backfill' command uses the path-walk API in a critical way: it
> uses the objects output from the command to find the batches of missing
> objects that should be requested from the server. Unlike 'git
> pack-objects', we cannot fall back to another mechanism.
>
> The previous change added the path_walk_filter_compatible() method that
> we can reuse here. Use it during argument validation in cmd_backfill().
>
> Signed-off-by: Derrick Stolee <[email-masked]>
> ---
>  builtin/backfill.c  | 2 ++
>  t/t5620-backfill.sh | 8 ++++++++
>  2 files changed, 10 insertions(+)

Another topic adds a helper function to check for many incompatible
options and calls it from here.  When I merged this topic, I made an
semi-evil merge to move this call to that function (with necessary
adjustment to the parameter).  Please sanity check the resolution I
made in 'seen'.  Thanks.

> diff --git a/builtin/backfill.c b/builtin/backfill.c
> index d794dd842f..51eaa42169 100644
> --- a/builtin/backfill.c
> +++ b/builtin/backfill.c
> @@ -144,6 +144,8 @@ int cmd_backfill(int argc, const char **argv, const char *prefix, struct reposit
>  
>  	if (argc > 1)
>  		die(_("unrecognized argument: %s"), argv[1]);
> +	if (!path_walk_filter_compatible(&ctx.revs.filter))
> +		die(_("cannot backfill with these filter options"));
>  
>  	repo_config(repo, git_default_config, NULL);
>  
> diff --git a/t/t5620-backfill.sh b/t/t5620-backfill.sh
> index f3b5e39493..3580e10b9c 100755
> --- a/t/t5620-backfill.sh
> +++ b/t/t5620-backfill.sh
> @@ -15,6 +15,14 @@ test_expect_success 'backfill rejects unexpected arguments' '
>  	test_grep "unrecognized argument: --unexpected-arg" err
>  '
>  
> +test_expect_success 'backfill rejects incompatible filter options' '
> +	test_must_fail git backfill --objects --filter=tree:1 2>err &&
> +	test_grep "cannot backfill with these filter options" err &&
> +
> +	test_must_fail git backfill --objects --filter=blob:limit=10m 2>err &&
> +	test_grep "cannot backfill with these filter options" err
> +'
> +
>  # We create objects in the 'src' repo.
>  test_expect_success 'setup repo for object creation' '
>  	echo "{print \$1}" >print_1.awk &&