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

Re: [PATCH v4 12/12] t: detect errors outside of test cases

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 18, 2026, 19:24 UTC
Message-ID
<xmqqtst8ul4q.fsf@gitster.g>
In-Reply-To
<20260418174446.GA1695@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 24 quoted lines
> On Sat, Apr 18, 2026 at 08:17:10AM -0400, Ben Knoble wrote:
>
>> > +if test "$GIT_TEST_USE_SET_E" = 1 && test "${BASH_VERSINFO:=0}" -ge 5
>> > then
>> >    set -e
>> > fi
>> 
>> I guess that should be || instead of &&?
>
> Oops, yeah. I wrote it correctly and tested it once, and then started to
> rewrite it to support setting it to 0, like:
>
>   if test -z "$GIT_TEST_USE_SET_E" && test "${BASH_VERSINFO:=0}" -ge 5
>   then
> 	GIT_TEST_USE_SET_E=1
>   fi
>   case "$GIT_TEST_USE_SET_E" in
>   1|on|true)
> 	set -e
> 	;;
>   esac
>
> But I didn't want to get too much into details of the patch, so I went
> back to the original, but obviously screwed that up. ;)

We could forget about "we know this is a good shell by its name and version" and test the feature we depend on ourselves, perhaps?

Previous: Jeff KingNext: Jeff King
Message 17 of 23 in “t: detect errors outside of test cases”
  1. 00/12 t: detect errors outside of test casesPatrick Steinhardt, Apr 17, 2026
  2. 01/12 t: prepare `test_match_signal ()` calls for `set -e`Patrick Steinhardt, Apr 17, 2026
  3. 02/12 t: prepare `test_must_fail ()` for `set -e`Patrick Steinhardt, Apr 17, 2026
  4. 03/12 t: prepare `stop_git_daemon ()` for `set -e`Patrick Steinhardt, Apr 17, 2026
  5. 04/12 t: prepare `git config --unset` calls for `set -e`Patrick Steinhardt, Apr 17, 2026
  6. 05/12 t: prepare conditional test execution for `set -e`Patrick Steinhardt, Apr 17, 2026
  7. 06/12 t: prepare execution of potentially failing commands for `set -e`Patrick Steinhardt, Apr 17, 2026
  8. 07/12 t: prepare `test_when_finished ()`/`test_atexit()` for `set -e`Patrick Steinhardt, Apr 17, 2026
  9. 08/12 t0008: silence error in subshell when using `grep -v`Patrick Steinhardt, Apr 17, 2026
  10. 09/12 t1301: don't fail in case setfacl(1) doesn't exist or failsPatrick Steinhardt, Apr 17, 2026
  11. 10/12 t6002: fix use of `expr` with `set -e`Patrick Steinhardt, Apr 17, 2026
  12. 11/12 t9902: fix use of `read` with `set -e`Patrick Steinhardt, Apr 17, 2026
  13. 12/12 t: detect errors outside of test casesPatrick Steinhardt, Apr 17, 2026
  14. Jeff KingApr 18, 2026
  15. Ben KnobleApr 18, 2026
  16. Jeff KingApr 18, 2026
  17. Junio C HamanoApr 18, 2026
  18. Jeff KingApr 18, 2026
  19. Patrick SteinhardtApr 20, 2026
  20. brian m. carlsonApr 18, 2026
  21. Jeff KingApr 18, 2026
  22. brian m. carlsonApr 18, 2026
  23. Jeff KingApr 19, 2026

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.