Subject: Re: [PATCH 02/20] contrib/examples/git-clone.sh: avoid "test <cond> -a/-o <cond>"

From: Junio C Hamano <[email-masked]>
Date: Mon, 09 Jun 2014 16:23:58 -0700

Elia Pinto <[email-masked]> writes:

> The construct is error-prone; "test" being built-in in most modern
> shells, the reason to avoid "test <cond> && test <cond>" spawning
> one extra process by using a single "test <cond> -a <cond>" no
> longer exists.
>
> Signed-off-by: Elia Pinto <[email-masked]>
> ---
>  contrib/examples/git-clone.sh |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/contrib/examples/git-clone.sh b/contrib/examples/git-clone.sh
> index b4c9376..08cf246 100755
> --- a/contrib/examples/git-clone.sh
> +++ b/contrib/examples/git-clone.sh
> @@ -516,7 +516,7 @@ then
>  
>  	case "$no_checkout" in
>  	'')
> -		test "z$quiet" = z -a "z$no_progress" = z && v=-v || v=
> +		test "z$quiet" = z && test "z$no_progress" = z && v=-v || v=
>  		git read-tree -m -u $v HEAD HEAD
>  	esac
>  fi

Hmph.  If we want to see them both empty, 

	test "$quiet,$no_progress" = ,

would have been a better way to spell this, but that is outside the
scope of this series.

But I wonder if we really want to update the contrib/examples/,
which is a record of how historically we have implemented various
scripted Porcelains using lower level plumbing commands.