Re: [PATCH] reflog: fix expire --single-worktree
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 30, 2023, 23:24 UTC
- Message-ID
- <xmqqa5rzbsmy.fsf@gitster.g>
- In-Reply-To
- <ZT/mN9RouiqzL9aT@nand.local>
Taylor Blau <me@ttaylorr.com> writes:
> This makes sense to me, but obviously won't catch non-tested cases.
True, but I think we can practically ignore non-tested cases.
The parse_options_check() is used to validate the whole options[] array that is passed to parse_options() family of API functions, and its validation is not limited to the options that are given from the command line in an invocation. A non-tested case would happen when a developer prepares and populates "struct option options[];" array for a (possibly new) git subcommand *and* never uses that array to call parse_options() in their implementation of that subcommand. The compiler would catch the unused variable options[] in such a case, and mark 1 eyeball would notice that none of the options defined in that array are actually understood by the command, no?