Skip to content

Commit 5bc12c1

Browse files
sunshinecogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f469873 commit 5bc12c1

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

t/perf/perf-lib.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,7 @@ test_run_perf_ () {
147147
"$GTIME" -f "%E %U %S" -o test_time.$i "$SHELL" -c '
148148
. '"$TEST_DIRECTORY"/test-lib-functions.sh'
149149
test_export () {
150-
[ $# != 0 ] || return 0
151-
test_export_="$test_export_ $1"
152-
shift
153-
test_export "$@"
150+
test_export_="$test_export_ $*"
154151
}
155152
'"$1"'
156153
ret=$?

0 commit comments

Comments
 (0)