Re: [PATCH 05/10] fetch tests: pass "mode" parameter first, pave way for "$@"
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 22, 2022, 06:01 UTC
- Message-ID
- <xmqqy1xp6xup.fsf@gitster.g>
- In-Reply-To
- <patch-05.10-a3fb3174bde-20220621T222854Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> 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.
Show 24 quoted lines
> @@ -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 && ...