diff --git a/builtin/backfill.c b/builtin/backfill.c index b98b0b591f..2c5ce56fb7 100644 --- a/builtin/backfill.c +++ b/builtin/backfill.c @@ -142,6 +142,9 @@ int cmd_backfill(int argc, const char **argv, const char *prefix, struct reposit repo_init_revisions(repo, &ctx.revs, prefix); argc = setup_revisions(argc, argv, &ctx.revs, NULL); + if (argc > 1) + die(_("unrecognized argument: %s"), argv[1]); + repo_config(repo, git_default_config, NULL); if (ctx.sparse < 0) diff --git a/t/t5620-backfill.sh b/t/t5620-backfill.sh index c6f54ee91c..2c347a91fe 100755 --- a/t/t5620-backfill.sh +++ b/t/t5620-backfill.sh @@ -7,6 +7,14 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./test-lib.sh +test_expect_success 'backfill rejects unexpected arguments' ' + test_must_fail git backfill unexpected-arg 2>err && + test_grep "ambiguous argument .*unexpected-arg" err && + + test_must_fail git backfill --all --unexpected-arg --first-parent 2>err && + test_grep "unrecognized argument: --unexpected-arg" err +' + # We create objects in the 'src' repo. test_expect_success 'setup repo for object creation' ' echo "{print \$1}" >print_1.awk &&