]> git.ipfire.org Git - thirdparty/git.git/commitdiff
perf: use GIT_PERF_REPEAT_COUNT=3 by default even without config file
authorRené Scharfe <l.s.r@web.de>
Sun, 25 Feb 2018 13:18:05 +0000 (14:18 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 27 Feb 2018 23:01:04 +0000 (15:01 -0800)
9ba95ed23c (perf/run: update get_var_from_env_or_config() for
subsections) stopped setting a default value for GIT_PERF_REPEAT_COUNT
if no perf config file is present, because get_var_from_env_or_config
returns early in that case.

Fix it by setting the default value after calling this function.  Its
fifth parameter is not used for any other variable, so remove the
associated code.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/perf/run

index 1a100d6134722b381bba9744f3ed01af3e4d3d8f..213da5d6b9437b7db7f3e5b824afea1df465d934 100755 (executable)
@@ -106,7 +106,6 @@ get_var_from_env_or_config () {
        conf_sec="$2"
        conf_var="$3"
        conf_opts="$4" # optional
-       # $5 can be set to a default value
 
        # Do nothing if the env variable is already set
        eval "test -z \"\${$env_var+x}\"" || return
@@ -122,13 +121,12 @@ get_var_from_env_or_config () {
        fi
        var="$conf_sec.$conf_var"
        conf_value=$(git config $conf_opts -f "$GIT_PERF_CONFIG_FILE" "$var") &&
-       eval "$env_var=\"$conf_value\"" && return
-
-       test -n "${5+x}" && eval "$env_var=\"$5\""
+       eval "$env_var=\"$conf_value\""
 }
 
 run_subsection () {
-       get_var_from_env_or_config "GIT_PERF_REPEAT_COUNT" "perf" "repeatCount" "--int" 3
+       get_var_from_env_or_config "GIT_PERF_REPEAT_COUNT" "perf" "repeatCount" "--int"
+       : ${GIT_PERF_REPEAT_COUNT:=3}
        export GIT_PERF_REPEAT_COUNT
 
        get_var_from_env_or_config "GIT_PERF_DIRS_OR_REVS" "perf" "dirsOrRevs"