git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/4] Replace use of `test <expr> -o/a <expr>`

From
Patrick Steinhardt <ps@pks.im>
Date
Nov 9, 2023, 10:53 UTC
Message-ID
<cover.1699526999.git.ps@pks.im>
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
Next: Patrick Steinhardt
Message 1 of 26 in “Replace use of `test <expr> -o/a <expr>`”
  1. 0/4 Replace use of `test <expr> -o/a <expr>`Patrick Steinhardt, Nov 9, 2023
  2. 1/4 global: convert trivial usages of `test <expr> -a/-o <expr>`Patrick Steinhardt, Nov 9, 2023
  3. Junio C HamanoNov 9, 2023
  4. Jeff KingNov 9, 2023
  5. Junio C HamanoNov 9, 2023
  6. Patrick SteinhardtNov 10, 2023
  7. 2/4 contrib/subtree: stop using `-o` to test for number of argsPatrick Steinhardt, Nov 9, 2023
  8. Jeff KingNov 9, 2023
  9. Junio C HamanoNov 9, 2023
  10. Patrick SteinhardtNov 10, 2023
  11. Junio C HamanoNov 10, 2023
  12. Patrick SteinhardtNov 10, 2023
  13. 3/4 contrib/subtree: convert subtree type check to use case statementPatrick Steinhardt, Nov 9, 2023
  14. Jeff KingNov 9, 2023
  15. 4/4 Makefile: stop using `test -o` when unlinking duplicate executablesPatrick Steinhardt, Nov 9, 2023
  16. 0/4 Replace use of `test <expr> -o/a <expr>`Patrick Steinhardt, Nov 10, 2023
  17. 1/4 global: convert trivial usages of `test <expr> -a/-o <expr>`Patrick Steinhardt, Nov 10, 2023
  18. Jeff KingNov 10, 2023
  19. Junio C HamanoNov 11, 2023
  20. Junio C HamanoNov 11, 2023
  21. Patrick SteinhardtNov 13, 2023
  22. Junio C HamanoNov 11, 2023
  23. 2/4 contrib/subtree: stop using `-o` to test for number of argsPatrick Steinhardt, Nov 10, 2023
  24. 3/4 contrib/subtree: convert subtree type check to use case statementPatrick Steinhardt, Nov 10, 2023
  25. 4/4 Makefile: stop using `test -o` when unlinking duplicate executablesPatrick Steinhardt, Nov 10, 2023
  26. Jeff KingNov 10, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.