@matheusbsbs / matheus-bagliano / commits / cbea86fd14
Fork 0

git-sh-setup: fix parseopt `eval` string underquoting

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>

Junio C Hamano committed Nov 7, 2007 at 23:04 UTC cbea86fd149f5d4aabdff06f87bc766d414b160e
1 file changed +6 -5
git-sh-setup.sh
+6 -5
@@ -21,11 +21,12 @@ if test -n "$OPTIONS_SPEC"; then
21 exec "$0" -h
22 }
23
24 - parseopt_extra=
25 - [ -n "$OPTIONS_KEEPDASHDASH" ] &&
26 - parseopt_extra="$parseopt_extra --keep-dashdash"
27 -
28 - eval `echo "$OPTIONS_SPEC" | git rev-parse --parseopt $parseopt_extra -- "$@" || echo exit $?`
24 + [ -n "$OPTIONS_KEEPDASHDASH" ] && parseopt_extra="--keep-dashdash"
25 + parsed=$(
26 + echo "$OPTIONS_SPEC" |
27 + git rev-parse --parseopt $parseopt_extra -- "$@"
28 + ) &&
29 + eval "$parsed" || exit
30 else
31 usage() {
32 die "Usage: $0 $USAGE"