git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 3/5] tests: only automatically unset matching values from test_config

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 16, 2022, 21:18 UTC
Message-ID
<xmqq35g4s3xl.fsf@gitster.g>
In-Reply-To
<20220616205456.19081-4-jacob.e.keller@intel.com>
Jacob Keller <jacob.keller@gmail.com> writes:
Show 5 quoted lines
> +	# 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.
Show 10 quoted lines
> +	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"
>  }
Previous: Jacob KellerNext: Jacob Keller
Message 3 of 14 in “support negative refspecs in git remote show”
  1. 0/5 support negative refspecs in git remote showJacob Keller, Jun 16, 2022
  2. 3/5 tests: only automatically unset matching values from test_configJacob Keller, Jun 16, 2022
  3. Junio C HamanoJun 16, 2022
  4. Jacob KellerJun 16, 2022
  5. 4/5 t5505: use test_config where appropriateJacob Keller, Jun 16, 2022
  6. 1/5 t5505: remove sub shell use in favor of git -CJacob Keller, Jun 16, 2022
  7. Junio C HamanoJun 16, 2022
  8. Jacob KellerJun 16, 2022
  9. 2/5 tests: handle --global directly in test_config/test_unconfigJacob Keller, Jun 16, 2022
  10. Junio C HamanoJun 16, 2022
  11. Jacob KellerJun 16, 2022
  12. 5/5 remote: handle negative refspecs in git remote showJacob Keller, Jun 16, 2022
  13. Junio C HamanoJun 16, 2022
  14. Jacob KellerJun 16, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.