Junio C Hamano wrote:
> You just made these two that the user clearly meant to express two
> different things indistinguishable.
>
> opt.sh -S
> opt.sh -S ''
[...]
> And that is exactly why gitcli.txt tells users to use the 'sticked'
> form, and ends the bullet point with:
>
> An option that takes optional option-argument must be written in
> the 'sticked' form.
Yes, another possibility in that vein would be to teach rev-parse
--parseopt an OPTIONS_LONG_STICKED output format, and then parse with
while :
do
case $1 in
--gpg-sign)
... no keyid ...
;;
--gpg-sign=*)
keyid=${1#--gpg-sign=}
...
;;
esac
shift
done
This still leaves
opt.sh -S
and
opt.sh -S''
indistinguishable. Given what the shell passes to execve, I think
that's ok.
The analagous method without preferring long options could work almost
as well:
while :
do
case $1 in
-S)
... no keyid ...
;;
-S?*)
keyid=${1#-S}
...
;;
esac
shift
done
but it mishandles "--gpg-sign=" with empty argument.
Jonathan
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html