From: Derrick Stolee via GitGitGadget Date: Sat, 02 May 2026 14:15:51 GMT Subject: [PATCH 4/7] backfill: die on incompatible filter options Message-ID: <22db528d0c5e6db71664f071dca97ab218f4ba45.1777731354.git.gitgitgadget@gmail.com> In-Reply-To: From: Derrick Stolee 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 --- builtin/backfill.c | 2 ++ t/t5620-backfill.sh | 8 ++++++++ 2 files changed, 10 insertions(+) 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 && -- gitgitgadget