Skip to content

Commit

Permalink
git-sh-setup: fix parseopt eval string underquoting
Browse files Browse the repository at this point in the history
The 'automagic parseopt' support corrupted non option parameters
that had IFS characters in them.  The worst case is when it had
a non option parameter like this:

	$1=" * some string"

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Nov 8, 2007
1 parent dfdd7e6 commit cbea86f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions git-sh-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ if test -n "$OPTIONS_SPEC"; then
exec "$0" -h
}

parseopt_extra=
[ -n "$OPTIONS_KEEPDASHDASH" ] &&
parseopt_extra="$parseopt_extra --keep-dashdash"

eval `echo "$OPTIONS_SPEC" | git rev-parse --parseopt $parseopt_extra -- "$@" || echo exit $?`
[ -n "$OPTIONS_KEEPDASHDASH" ] && parseopt_extra="--keep-dashdash"
parsed=$(
echo "$OPTIONS_SPEC" |
git rev-parse --parseopt $parseopt_extra -- "$@"
) &&
eval "$parsed" || exit
else
usage() {
die "Usage: $0 $USAGE"
Expand Down

0 comments on commit cbea86f

Please sign in to comment.