Subject: Re: [PATCH 2/5] Update git-sh-setup(1) to allow transparent use of git-rev-parse --parseopt

From: Junio C Hamano <[email-masked]>
Date: Sun, 04 Nov 2007 00:43:53 -0700

Pierre Habouzit <[email-masked]> writes:

> If you set OPTIONS_SPEC, git-sh-setups uses git-rev-parse --parseopt
> automatically.
>
> It also diverts usage to re-exec $0 with the -h option as parse-options.c
> will catch that.
>
> PARSEOPT_OPTS can also be used to pass options git git-rev-parse --parseopt
> mode (like --keep-dashdash).
>
> Signed-off-by: Pierre Habouzit <[email-masked]>
> ...
> +if test -n "$OPTIONS_SPEC"; then
> +	usage() {
> +		exec "$0" -h
> +	}
> +
> +	eval `echo "$OPTIONS_SPEC" | git rev-parse --parseopt $PARSEOPT_OPTS -- "$@" || echo exit $?`

I do not quite get why you use $PARSEOPT_OPTS without setting
any yourself, which means that the users can screw themselves by
having something random and insane in their environments.

Trust me that this kind of backdoor, especially when the
intended uses of the backdoor is not documented well, will be
abused by (perhaps clueless, perhaps curious, perhaps fearless)
users and you will get blamed.

So I'd rather (1) first find out what _you_ wanted to use this
backdoor for, (2) see if that is a useful feature to share with
others instead of keeping that to yourself, and (3) if so to
have a much narrower interface to allow such an option that
cannot be abused.

The same comment applies to the git-clone one which has a
similar invocation of "rev-parse --parseopt" because it cannot
source git-sh-setup.