Re: [PATCH 02/20] contrib/examples/git-clone.sh: avoid "test <cond> -a/-o <cond>"
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 9, 2014, 23:23 UTC
- Message-ID
- <xmqqha3td5v5.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <1402066563-28519-3-git-send-email-gitter.spiros@gmail.com>
Elia Pinto <gitter.spiros@gmail.com> writes:
Show 23 quoted lines
> 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 <gitter.spiros@gmail.com> > --- > 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.