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

Re: [PATCH 1/2] t9902: fix 'test A == B' to use = operator

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 8, 2013, 17:20 UTC
Message-ID
<7v1u790xzj.fsf@alter.siamese.dyndns.org>
In-Reply-To
<b9e889a27f648c44179ad39159240867f86525f3.1373296313.git.trast@inf.ethz.ch>
Thomas Rast <trast@inf.ethz.ch> writes:
> The == operator as an alias to = is not POSIX.  This doesn't actually
> matter for the execution of the script, because it only runs when the
> shell is bash.  However, it trips up test-lint, so it's nicer to use
> the standard form.

OK, my knee-jerk reaction was "this is only for bash" as you said, but the test-lint part I agree with.

But then test-lint _ought_ to also catch the use of "local" in the ideal world, so perhaps in the longer term we would need to treat this bash-only script differently from others anyway???

Show 19 quoted lines
>
> Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
> ---
>  t/t9902-completion.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
> index d9e3103..272a071 100755
> --- a/t/t9902-completion.sh
> +++ b/t/t9902-completion.sh
> @@ -69,7 +69,7 @@ run_completion ()
>  	local -a COMPREPLY _words
>  	local _cword
>  	_words=( $1 )
> -	test "${1: -1}" == ' ' && _words+=('')
> +	test "${1: -1}" = ' ' && _words+=('')
>  	(( _cword = ${#_words[@]} - 1 ))
>  	__git_wrap__git_main && print_comp
>  }
Previous: Torsten BögershausenNext: Thomas Rast
Message 8 of 10 in “t0000: do not use export X=Y”
  1. t0000: do not use export X=YTorsten Bögershausen, Jul 8, 2013
  2. Thomas RastJul 8, 2013
  3. 1/2 t9902: fix 'test A == B' to use = operatorThomas Rast, Jul 8, 2013
  4. 2/2 test-lint: detect 'export FOO=bar'Thomas Rast, Jul 8, 2013
  5. Torsten BögershausenJul 8, 2013
  6. Thomas RastJul 9, 2013
  7. Torsten BögershausenJul 9, 2013
  8. Junio C HamanoJul 8, 2013
  9. Thomas RastJul 9, 2013
  10. Junio C HamanoJul 8, 2013

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.