git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jacob Keller <jacob.keller@gmail.com>
Cc: git@vger.kernel.org, Taylor Blau <me@ttaylorr.com>,
	Jacob Keller <jacob.e.keller@intel.com>
Subject: Re: [PATCH v2 3/5] tests: only automatically unset matching values from test_config
Date: Thu, 16 Jun 2022 14:18:14 -0700	[thread overview]
Message-ID: <xmqq35g4s3xl.fsf@gitster.g> (raw)
In-Reply-To: <20220616205456.19081-4-jacob.e.keller@intel.com> (Jacob Keller's message of "Thu, 16 Jun 2022 13:54:54 -0700")

Jacob Keller <jacob.keller@gmail.com> writes:

> +	# Only enable --fixed-value if we have two parameters
> +	if test $# < 2
> +	then
> +		fixedvalue=
> +	fi

Two comments:

 * Does "<" do what you expect to do?  Did you mean "-lt"?

 * Using "bug in the test script: $*" and diagnosing missing
   parameters, instead of silently ignoring the option the developer
   wrote, would be more preferrable.

> +	git ${config_dir:+-C "$config_dir"} config ${global:+--global} ${fixedvalue:+--fixed-value} --unset-all "$1" "$2"
>  	config_status=$?
>  	case "$config_status" in
>  	5) # ok, nothing to unset
> @@ -575,7 +586,7 @@ test_config () {
>  		esac
>  		shift
>  	done
> -	test_when_finished "test_unconfig ${config_dir:+-C '$config_dir'} ${global:+--global} '$1'" &&
> +	test_when_finished "test_unconfig ${config_dir:+-C '$config_dir'} --fixed-value ${global:+--global} '$1' '$2'" &&

Why are $1 and $2 enclosed in a pair of single quotes?  Is the
assumption that they do not contain a single quote themselves?

I guess that is true also for config_dir and shares the same
problem, so you are not introducing a new problem.

>  	git ${config_dir:+-C "$config_dir"} config ${global:+--global} "$1" "$2"
>  }

  reply	other threads:[~2022-06-16 21:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-16 20:54 [PATCH v2 0/5] support negative refspecs in git remote show Jacob Keller
2022-06-16 20:54 ` [PATCH v2 1/5] t5505: remove sub shell use in favor of git -C Jacob Keller
2022-06-16 21:09   ` Junio C Hamano
2022-06-16 21:10     ` Jacob Keller
2022-06-16 20:54 ` [PATCH v2 2/5] tests: handle --global directly in test_config/test_unconfig Jacob Keller
2022-06-16 21:34   ` Junio C Hamano
2022-06-16 22:08     ` Jacob Keller
2022-06-16 20:54 ` [PATCH v2 3/5] tests: only automatically unset matching values from test_config Jacob Keller
2022-06-16 21:18   ` Junio C Hamano [this message]
2022-06-16 22:07     ` Jacob Keller
2022-06-16 20:54 ` [PATCH v2 4/5] t5505: use test_config where appropriate Jacob Keller
2022-06-16 20:54 ` [PATCH v2 5/5] remote: handle negative refspecs in git remote show Jacob Keller
2022-06-16 21:31 ` [PATCH v2 0/5] support " Junio C Hamano
2022-06-16 22:08   ` Jacob Keller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq35g4s3xl.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=jacob.keller@gmail.com \
    --cc=me@ttaylorr.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).