Re: [PATCH v3] backfill: handle unexpected arguments
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Mar 22, 2026, 23:01 UTC
- Message-ID
- <d8e6f854-e838-439f-bc5a-27cbb4091e4f@gmail.com>
- In-Reply-To
- <20260322053207.60992-1-r.siddharth.shrimali@gmail.com>
On 3/22/26 1:32 AM, Siddharth Shrimali wrote:
> git backfill takes no non-option arguments. However, if extra > arguments are passed with git backfill, parse_options() leaves > them in argc and the command ignores them silently, giving the > user no indication that something is wrong.
Show 9 quoted lines
> @@ -135,6 +135,11 @@ int cmd_backfill(int argc, const char **argv, const char *prefix, struct reposit
>
> argc = parse_options(argc, argv, prefix, options, builtin_backfill_usage,
> 0);
> +
> + if (argc) {
> + error(_("unknown argument '%s'"), argv[0]);
> + usage(builtin_backfill_usage[0]);
> + }Before we get too far into this: How does this interact with the ongoing change to introduce revision arguments to 'git backfill' [1]? I suppose that the important bit would be that we still parse arguments using the revision walk machinery at some point, but it would be difficult to guarantee that when working on a patch disconnected from that series.
[1] https://lore.kernel.org/git/pull.2070.git.1773707361.gitgitgadget@gmail.com/
Thanks, -Stolee