Re: [PATCH 0/2] contrib/subtree: Add -S/--gpg-sign option
- From
- Patrik Weiskircher <patrik.weiskircher@nutrient.io>
- Date
- Jun 2, 2025, 13:12 UTC
- Message-ID
- <CANMzfzgggS0T9=5FtTdDi0PmVyfQJSp3_nyhj8FxUCj1wSpnZw@mail.gmail.com>
- In-Reply-To
- <xmqqo6v9es3s.fsf@gitster.g>
On Fri, May 30, 2025 at 4:55 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 11 quoted lines
> > Patrik Weiskircher <patrik.weiskircher@nutrient.io> writes: > > > This means my options become: > > 1. use --stuck-long or > > 2. make -S not take any parameter or > > 3. make -S require a parameter > > 4. accept "-S[<key-id>]" in stuck form, and --gpg-sign[=<key-id>] > > which is a variant of #1 may be an option?
Not with git rev-parse, unfortunately. Either `-Sabc` or `--gpg-sign=abc` would get transformed into `-S 'abc'` after rev-parse, where we run into the ambiguity of what is an optional argument again. I *could* parse this manually without git rev-parse beforehand, but that seems like just adding yet-another difficult to maintain thing.
``` $ echo $OPTS_SPEC | git rev-parse --parseopt -- "--gpg-sign=abcd" set -- -S 'abcd' --
$ echo $OPTS_SPEC | git rev-parse --parseopt -- "-Sabcd" set -- -S 'abcd' -- ```