On Sat, Nov 6, 2021 at 5:47 PM Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> wrote: > The usage of OPT_CMDMODE() in "cat-file"[1] was added in parallel with > the development of[3] the --batch-all-objects option[4], so we've > since grown[5] checks that it can't be combined with other command > modes, when it should just be made a top-level command-mode > instead. It doesn't combine with --filters, --textconv etc. > > By giving parse_options() information about what options are mutually > exclusive with one another we can get the die9) message being removed > here for free, we didn't even use that removed message in some cases, > e.g. for both of: s/die9)/die()/ > --batch-all-objects --textconv > --batch-all-objects --filters > > We'd take the "goto usage" in the "if (opt)" branch, and never reach > the previous message. Now we'll emit e.g.: > > $ git cat-file --batch-all-objects --filters > error: option `filters' is incompatible with --batch-all-objects > > 1. b48158ac94c (cat-file: make the options mutually exclusive, 2015-05-03) > 2. https://lore.kernel.org/git/xmqqtwspgusf.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxx/ > 3. https://lore.kernel.org/git/20150622104559.GG14475@xxxxxxxx/ > 4. 6a951937ae1 (cat-file: add --batch-all-objects option, 2015-06-22) > 5. 321459439e1 (cat-file: support --textconv/--filters in batch mode, 2016-09-09) > > Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>