summaryrefslogtreecommitdiff
path: root/t/perf/perf-lib.sh
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2020-12-20 21:27:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-12-22 21:45:36 (GMT)
commit5bc12c11ccdd3126cf04cf08cf59bf3c204f7f2a (patch)
treed6fb85ac6b3f0e8f8e4ed500a2d1e4db3a3e6e0e /t/perf/perf-lib.sh
parentf4698738f9dbe733e64f968fff95a9a4f881431e (diff)
downloadgit-5bc12c11ccdd3126cf04cf08cf59bf3c204f7f2a.zip
git-5bc12c11ccdd3126cf04cf08cf59bf3c204f7f2a.tar.gz
git-5bc12c11ccdd3126cf04cf08cf59bf3c204f7f2a.tar.bz2
t/perf: avoid unnecessary test_export() recursion
test_export() has been self-recursive since its inception even though a simple for-loop would have served just as well to append its arguments to the `test_export_` variable separated by the pipe character "|". Recently `test_export_` was changed instead to a space-separated list of tokens to be exported, an operation which can be accomplished via a single simple assignment, with no need for looping or recursion. Therefore, simplify the implementation. While at it, take advantage of the fact that variable names to be exported are shell identifiers, thus won't be composed of special characters or whitespace, thus simple a `$*` can be used rather than magical `"$@"`. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/perf/perf-lib.sh')
-rw-r--r--t/perf/perf-lib.sh5
1 files changed, 1 insertions, 4 deletions
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index 22d727c..e385c68 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -147,10 +147,7 @@ test_run_perf_ () {
"$GTIME" -f "%E %U %S" -o test_time.$i "$SHELL" -c '
. '"$TEST_DIRECTORY"/test-lib-functions.sh'
test_export () {
- [ $# != 0 ] || return 0
- test_export_="$test_export_ $1"
- shift
- test_export "$@"
+ test_export_="$test_export_ $*"
}
'"$1"'
ret=$?