git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Replace use of `test <expr> -o/a <expr>`
@ 2023-11-09 10:53 Patrick Steinhardt
  2023-11-09 10:53 ` [PATCH 1/4] global: convert trivial usages of `test <expr> -a/-o <expr>` Patrick Steinhardt
                   ` (4 more replies)
  0 siblings, 5 replies; 26+ messages in thread
From: Patrick Steinhardt @ 2023-11-09 10:53 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Junio C Hamano

[-- Attachment #1: Type: text/plain, Size: 1337 bytes --]

Hi,

this patch series replaces all uses of `test <expr> -o/a <expr>` that I
was able to find in our codebase. This is in accordance to our coding
guidelines:

 - 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.

This patch series is a result of the discussion at [1].

Patrick

[1]: <20231109073250.GA2698227@coredump.intra.peff.net>

Patrick Steinhardt (4):
  global: convert trivial usages of `test <expr> -a/-o <expr>`
  contrib/subtree: stop using `-o` to test for number of args
  contrib/subtree: convert subtree type check to use case statement
  Makefile: stop using `test -o` when unlinking duplicate executables

 GIT-VERSION-GEN                |  2 +-
 Makefile                       |  2 +-
 configure.ac                   |  2 +-
 contrib/subtree/git-subtree.sh | 34 +++++++++++++++++++++++-----------
 t/perf/perf-lib.sh             |  2 +-
 t/perf/run                     |  9 +++++----
 t/valgrind/valgrind.sh         |  2 +-
 7 files changed, 33 insertions(+), 20 deletions(-)

-- 
2.42.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2023-11-13  7:12 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-09 10:53 [PATCH 0/4] Replace use of `test <expr> -o/a <expr>` Patrick Steinhardt
2023-11-09 10:53 ` [PATCH 1/4] global: convert trivial usages of `test <expr> -a/-o <expr>` Patrick Steinhardt
2023-11-09 11:41   ` Junio C Hamano
2023-11-09 18:48     ` Jeff King
2023-11-09 22:56       ` Junio C Hamano
2023-11-10 10:18       ` Patrick Steinhardt
2023-11-09 10:53 ` [PATCH 2/4] contrib/subtree: stop using `-o` to test for number of args Patrick Steinhardt
2023-11-09 18:55   ` Jeff King
2023-11-09 23:02     ` Junio C Hamano
2023-11-10 10:18       ` Patrick Steinhardt
2023-11-10 23:27         ` Junio C Hamano
2023-11-10 10:18     ` Patrick Steinhardt
2023-11-09 10:53 ` [PATCH 3/4] contrib/subtree: convert subtree type check to use case statement Patrick Steinhardt
2023-11-09 18:56   ` Jeff King
2023-11-09 10:53 ` [PATCH 4/4] Makefile: stop using `test -o` when unlinking duplicate executables Patrick Steinhardt
2023-11-10 10:01 ` [PATCH v2 0/4] Replace use of `test <expr> -o/a <expr>` Patrick Steinhardt
2023-11-10 10:01   ` [PATCH v2 1/4] global: convert trivial usages of `test <expr> -a/-o <expr>` Patrick Steinhardt
2023-11-10 21:44     ` Jeff King
2023-11-11  0:14       ` Junio C Hamano
2023-11-11  0:20         ` Junio C Hamano
2023-11-13  7:12           ` Patrick Steinhardt
2023-11-11  0:12     ` Junio C Hamano
2023-11-10 10:01   ` [PATCH v2 2/4] contrib/subtree: stop using `-o` to test for number of args Patrick Steinhardt
2023-11-10 10:01   ` [PATCH v2 3/4] contrib/subtree: convert subtree type check to use case statement Patrick Steinhardt
2023-11-10 10:01   ` [PATCH v2 4/4] Makefile: stop using `test -o` when unlinking duplicate executables Patrick Steinhardt
2023-11-10 21:46   ` [PATCH v2 0/4] Replace use of `test <expr> -o/a <expr>` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).