Nicolas Vigier wrote:

> I'm thinking about a patch to add the following two options to rev-parse :
> --sticked-opt-args::
>       Only meaningful in --parseopt mode. Tells the options parser to
>       output options with optional arguments in sticked form. The
>       default is to output them in non-sticked mode, which can be
>       difficult to parse unambiguously.
> --long-options::
>       Only meaningful in --parseopt mode. Tells the options parser to
>       output long option names, when available. The default is to use
>       short option names when available.
> When you want to handle optional args unambiguously, you use the
> --sticked-opt-args option. And if you think an empty value can be
> a meaningful value, you add the --long-options option to be able to
> distinguish them.
> Would it make sense ?

That would make four distinct output formats:

 --sticked --long:
        Doesn't lose any information that normal use of C parse_options
        would have kept, as long as every short option with optional
        argument has a corresponding long option.

 --sticked --no-long:
        Loses the distinction between --gpg-sign and --gpg-sign=

 --no-sticked --long:
        Semantically equivalent to the existing output, just noisier.

 --no-sticked --no-long:
        The existing output.

Are all of them needed?  Is it worth tempting people to use --sticked
--no-long when we know its pitfalls?

I would think that only the current normalized form and --sticked
--long would need to be supported.

The fix you originally proposed seems tolerable to me, too --- it is
not very invasive, and while it doesn't distinguish the empty-argument
form "--gpg-sign=", that's a bit of an edge case.

The main reason I slightly prefer the solution that makes the output
use long, sticked options on request is that the "normalized"
commandline would start being an actual equivalent command line the
command expects, instead of a weird, subtly different syntax.  (That
problem already exists with or without your patch --- the patch just
draws attention to it.)
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to