diff options
| author | Patrick Steinhardt <ps@pks.im> | 2023-11-10 11:01:15 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-11-11 09:21:00 +0900 |
| commit | 13420028e5b119d27277d521f4d267212c5ca21c (patch) | |
| tree | 4d5279a48a367ea27df13cbeb8e9ba1b1dae3808 /t/valgrind/valgrind.sh | |
| parent | Git 2.43-rc1 (diff) | |
| download | git-13420028e5b119d27277d521f4d267212c5ca21c.tar.gz git-13420028e5b119d27277d521f4d267212c5ca21c.zip | |
global: convert trivial usages of `test <expr> -a/-o <expr>`
Our coding guidelines say to not use `test` with `-a` and `-o` because
it can easily lead to bugs. Convert trivial cases where we still use
these to instead instead concatenate multiple invocations of `test` via
`&&` and `||`, respectively.
While not all of the converted instances can cause ambiguity, it is
worth getting rid of all of them regardless:
- It becomes easier to reason about the code as we do not have to
argue why one use of `-a`/`-o` is okay while another one isn't.
- We don't encourage people to use these expressions.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/valgrind/valgrind.sh')
| -rwxr-xr-x | t/valgrind/valgrind.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/t/valgrind/valgrind.sh b/t/valgrind/valgrind.sh index 669ebaf68b..3c8ee19975 100755 --- a/t/valgrind/valgrind.sh +++ b/t/valgrind/valgrind.sh @@ -23,7 +23,7 @@ memcheck) VALGRIND_MAJOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*\([0-9]*\)') VALGRIND_MINOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*[0-9]*\.\([0-9]*\)') test 3 -gt "$VALGRIND_MAJOR" || - test 3 -eq "$VALGRIND_MAJOR" -a 4 -gt "$VALGRIND_MINOR" || + { test 3 -eq "$VALGRIND_MAJOR" && test 4 -gt "$VALGRIND_MINOR"; } || TOOL_OPTIONS="$TOOL_OPTIONS --track-origins=yes" ;; *) |
