Re: [PATCH 2/5] cat-file: mention --unordered along with --batch-all-objects
- From
Jeff King <peff@peff.net>
- Date
- Oct 8, 2021, 02:30 UTC
- Message-ID
- <YV+tXVWVuy/rZn/l@coredump.intra.peff.net>
- In-Reply-To
- <87k0ipgmbb.fsf@evledraar.gmail.com>
On Thu, Oct 07, 2021 at 12:18:45PM +0200, Ævar Arnfjörð Bjarmason wrote:
Show 12 quoted lines
> >> 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.
> >
> > This is not right. --batch-all-objects does not provide a mode exclusive
> > with "-t", etc, by itself.
>
> Yes it does. See the "if (opt) {" branch on master. We just don't
> implement it via a cmdmode, but --batch-all-objects can definitely be a
> CMDMODE (I see you found that out below...)I agree that if you make it a CMDMODE it does not introduce any bugs. But it is semantically confusing. You would not make, say, --buffer a CMDMODE option. It is a flag which only takes effect under certain modes. And the same is true of --batch-all-objects, which modifies the batch cmd modes.
In fact, it _would_ be a bug to make it a CMDMODE if --batch were correctly marked as one (but it is not sufficient to reason the other way; --batch without --batch-all-objects is still mutually exclusive with -t, etc).
What really makes things confusing, IMHO, is the --textconv and --filter options. They are marked as CMDMODEs, and they are indeed mutually exclusive with -t, etc. But they also work with --batch, which is itself a different mode.
So I don't think OPT_CMDMODE could ever present this complete set of rules, because they are not all mutually exclusive with each other. But I think calling "--batch-all-objects" a mode is just muddying the waters even further.
-Peff