diff options
author | SZEDER Gábor <szeder@ira.uka.de> | 2016-04-22 22:32:21 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-04-22 13:55:28 -0700 |
commit | 0ff74101dcc6050190b5f55da1b79a3df1611804 (patch) | |
tree | 07b906c7e7399b09a2e2a20026729bc65d96360d /t/test-lib.sh | |
parent | 6a6636270fbaf74609cd3e1bd207dd2c420d640a (diff) | |
download | git-0ff74101dcc6050190b5f55da1b79a3df1611804.tar.gz git-0ff74101dcc6050190b5f55da1b79a3df1611804.tar.xz |
test-lib: simplify '--option=value' parsing
To get the 'value' from '--option=value', test-lib.sh parses said
option running 'expr' with a regexp. This involves a subshell, an
external process, and a lot of non-alphanumeric characters in the
regexp.
Use a much simpler POSIX-defined shell parameter expansion instead to
do the same.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/test-lib.sh')
-rw-r--r-- | t/test-lib.sh | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh index 0b47eb6bb..79afa8748 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -202,13 +202,13 @@ do } run_list=$1; shift ;; --run=*) - run_list=$(expr "z$1" : 'z[^=]*=\(.*\)'); shift ;; + run_list=${1#--*=}; shift ;; -h|--h|--he|--hel|--help) help=t; shift ;; -v|--v|--ve|--ver|--verb|--verbo|--verbos|--verbose) verbose=t; shift ;; --verbose-only=*) - verbose_only=$(expr "z$1" : 'z[^=]*=\(.*\)') + verbose_only=${1#--*=} shift ;; -q|--q|--qu|--qui|--quie|--quiet) # Ignore --quiet under a TAP::Harness. Saying how many tests @@ -222,15 +222,15 @@ do valgrind=memcheck shift ;; --valgrind=*) - valgrind=$(expr "z$1" : 'z[^=]*=\(.*\)') + valgrind=${1#--*=} shift ;; --valgrind-only=*) - valgrind_only=$(expr "z$1" : 'z[^=]*=\(.*\)') + valgrind_only=${1#--*=} shift ;; --tee) shift ;; # was handled already --root=*) - root=$(expr "z$1" : 'z[^=]*=\(.*\)') + root=${1#--*=} shift ;; --chain-lint) GIT_TEST_CHAIN_LINT=1 |