Jonathan Nieder <jrnie...@gmail.com> writes:

> Perhaps something like the following would work?
>
>       tree-wide: convert test -a/-o to && and ||
>
>       The interaction with unary operators and operator precedence
>       for && and || are better known than -a and -o, and for that
>       reason we prefer them.  Replace all existing instances in git
>       of -a and -o to save readers from the burden of thinking
>       about such things.
>
>       Add a check-non-portable-shell.pl to avoid more instances of
>       test -a and -o arising in the future.

Yeah, the title is certainly better than "-a or -b option" I see
above ;-) and a single tree-wide fix may be OK while the tree is
quiescent.

I however do think "better known" is much less of an issue than that
"-a/-o" is more error prone e.g. 'test -n "$x" -a a = b' is buggy
because it does not consider that $x could be "=".



> [...]
>> -                    test $status = D -o $status = T && echo "$sm_path" && 
>> continue
>> +                     ( test $status = D || test $status = T ) && echo 
>> "$sm_path" && continue
>
> There's no need for a subshell for this.  Better to use a block:
>
>                       {
>                               test "$status" = D ||
>                               test "$status" = T
>                       } &&
>                       echo "$sm_path" &&
>                       continue

Yes.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to