]> Kevux Git Server - rit/commit
t6002: fix use of `expr` with `set -e`
authorPatrick Steinhardt <ps@pks.im>
Tue, 21 Apr 2026 07:34:23 +0000 (09:34 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 22 Apr 2026 22:53:36 +0000 (15:53 -0700)
commit090af9957c14915461f302f422d2c147b3e9175b
tree0c10ec63f8074ac9085b5f148b9860c990d27639
parent4f917bbf718047dc1b3c4346a9c47c84a52a810b
t6002: fix use of `expr` with `set -e`

In `test_bisection_diff ()` we use `expr` to perform some math. This
command has some gotchas though in that it will only return success when
the result is neither null nor zero. In some of our cases though it
actually _is_ zero, and that will cause the expressions to fail once we
enable `set -e`.

Prepare for this change by instead using `$(( ))`, which doesn't have
the same issue. While at it, modernize the function a tiny bit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6002-rev-list-bisect.sh