{"thread":{"id":"47923","subject":"[PATCH] perf: use GIT_PERF_REPEAT_COUNT=3 by default even without config file","startedAt":"2018-02-25T13:18:27Z","lastAt":"2018-02-25T13:18:27Z","messageCount":1,"participants":["René Scharfe"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"340207","messageId":"d80b51db-a746-e526-5005-141504f087bc@web.de","threadId":"47923","inReplyTo":null,"subject":"[PATCH] perf: use GIT_PERF_REPEAT_COUNT=3 by default even without config file","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2018-02-25T13:18:05Z","receivedAt":"2018-02-25T13:18:27Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"9ba95ed23c (perf/run: update get_var_from_env_or_config() for\nsubsections) stopped setting a default value for GIT_PERF_REPEAT_COUNT\nif no perf config file is present, because get_var_from_env_or_config\nreturns early in that case.\n\nFix it by setting the default value after calling this function.  Its\nfifth parameter is not used for any other variable, so remove the\nassociated code.\n\nSigned-off-by: Rene Scharfe <l.s.r@web.de>\n---\n t/perf/run | 8 +++-----\n 1 file changed, 3 insertions(+), 5 deletions(-)\n\ndiff --git a/t/perf/run b/t/perf/run\nindex 1a100d6134..213da5d6b9 100755\n--- a/t/perf/run\n+++ b/t/perf/run\n@@ -106,29 +106,27 @@ get_var_from_env_or_config () {\n \tconf_sec=\"$2\"\n \tconf_var=\"$3\"\n \tconf_opts=\"$4\" # optional\n-\t# $5 can be set to a default value\n \n \t# Do nothing if the env variable is already set\n \teval \"test -z \\\"\\${$env_var+x}\\\"\" || return\n \n \ttest -z \"$GIT_PERF_CONFIG_FILE\" && return\n \n \t# Check if the variable is in the config file\n \tif test -n \"$GIT_PERF_SUBSECTION\"\n \tthen\n \t\tvar=\"$conf_sec.$GIT_PERF_SUBSECTION.$conf_var\"\n \t\tconf_value=$(git config $conf_opts -f \"$GIT_PERF_CONFIG_FILE\" \"$var\") &&\n \t\teval \"$env_var=\\\"$conf_value\\\"\" && return\n \tfi\n \tvar=\"$conf_sec.$conf_var\"\n \tconf_value=$(git config $conf_opts -f \"$GIT_PERF_CONFIG_FILE\" \"$var\") &&\n-\teval \"$env_var=\\\"$conf_value\\\"\" && return\n-\n-\ttest -n \"${5+x}\" && eval \"$env_var=\\\"$5\\\"\"\n+\teval \"$env_var=\\\"$conf_value\\\"\"\n }\n \n run_subsection () {\n-\tget_var_from_env_or_config \"GIT_PERF_REPEAT_COUNT\" \"perf\" \"repeatCount\" \"--int\" 3\n+\tget_var_from_env_or_config \"GIT_PERF_REPEAT_COUNT\" \"perf\" \"repeatCount\" \"--int\"\n+\t: ${GIT_PERF_REPEAT_COUNT:=3}\n \texport GIT_PERF_REPEAT_COUNT\n \n \tget_var_from_env_or_config \"GIT_PERF_DIRS_OR_REVS\" \"perf\" \"dirsOrRevs\"\n-- \n2.16.2\n"}]}