Subject: Re: [PATCH 05/10] fetch tests: pass "mode" parameter first, pave way for "$@"

From: Junio C Hamano <[email-masked]>
Date: Tue, 21 Jun 2022 23:01:02 -0700

Ævar Arnfjörð Bjarmason  <[email-masked]> writes:

> +	local cmdline="$@" &&

Unless you are using the magic trait of "$@" that lets you pass each
positional parameter without getting split at internal $IFS, it is
less confusing to write "$*", which will make it obvious that a
later use of $cmdline will lose the distinction between
inter-parameter spaces and a whitespace that was embedded inside
an individual parameter.

> @@ -915,8 +930,8 @@ test_configured_prune_type () {
>  }
>  
>  test_configured_prune () {
> -	test_configured_prune_type "$@" "name" &&
> -	test_configured_prune_type "$@" "link"
> +	test_configured_prune_type --mode name "$@" &&
> +	test_configured_prune_type --mode link "$@"
>  }
>  
>  # $1 config: fetch.prune
> @@ -1007,11 +1022,19 @@ test_configured_prune unset unset unset true pruned  kept \
>  # +refs/heads/*:refs/remotes/origin/* refspec and supplying it on the
>  # command-line negates --prune-tags, the branches will not be pruned.
>  test_configured_prune_type_branch () {
> -	test_configured_prune_type "$1" "$2" "$3" "$4" pruned "$6" "$7" "name"
> -	test_configured_prune_type "$1" "$2" "$3" "$4" kept   "$6" "$7" "link"
> +	local cfg_fp="$1" &&
> +	local cfg_rnp="$2" &&
> +	local cfg_fpt="$3" &&
> +	local cfg_rnpt="$4" &&
> +	local arg_branch="$5" &&
> +	local arg_tag="$6" &&
> +	shift 6 &&

Unless we plan to never allow new parameters to be added (or
existing one retired) from this helper, it would probably be easier
to maintain if you wrote

	local cfg_fp="$1" && shift &&
	local cfg_rnp="$1" && shift &&
	...