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>
This commit is contained in:

committed by
Junio C Hamano

parent
dadef801b3
commit
13420028e5
@ -489,13 +489,13 @@ find_existing_splits () {
|
||||
;;
|
||||
END)
|
||||
debug "Main is: '$main'"
|
||||
if test -z "$main" -a -n "$sub"
|
||||
if test -z "$main" && test -n "$sub"
|
||||
then
|
||||
# squash commits refer to a subtree
|
||||
debug " Squash: $sq from $sub"
|
||||
cache_set "$sq" "$sub"
|
||||
fi
|
||||
if test -n "$main" -a -n "$sub"
|
||||
if test -n "$main" && test -n "$sub"
|
||||
then
|
||||
debug " Prior: $main -> $sub"
|
||||
cache_set $main $sub
|
||||
|
Reference in New Issue
Block a user