Christian Couder <[email protected]> writes:
> Hi Stephan,
>
> On Fri, Feb 26, 2016 at 10:38 PM, Stephan Beyer <[email protected]> wrote:
>> Hi Christian,
>>
>> On 02/26/2016 07:53 AM, Christian Couder wrote:
>>>> +test_expect_success 'bisect algorithm works in linear history with an odd
>>>> number of commits' '
>>>> + git bisect start A7 &&
>>>> + git bisect next &&
>>>> + test "$(git rev-parse HEAD)" = "$(git rev-parse A3)" \
>>>> + -o "$(git rev-parse HEAD)" = "$(git rev-parse A4)"
>>>
>>> I thought that we should not use "-o" and "-a" but instead "|| test"
>>> and "&& test".
>>
>> Why is this?
>
> I think it is because it might not be very portable, but I am not sure
> I remember well the previous discussions about this.
See Documentation/CodingGuidelines:
- We do not write our "test" command with "-a" and "-o" and use "&&"
or "||" to concatenate multiple "test" commands instead, because
the use of "-a/-o" is often error-prone. E.g.
test -n "$x" -a "$a" = "$b"
is buggy and breaks when $x is "=", but
test -n "$x" && test "$a" = "$b"
does not have such a problem.
Regarding portability, test -a/-o is not strictly POSIX (it's in the XSI
extension), but AFAIK implemented by all reasonable shells.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html