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

Re: [RFC PATCH] bisect run: allow inverting meaning of exit code

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 7, 2020, 01:42 UTC
Message-ID
<xmqqpnfw6nz1.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CAD_xR9dGNKdVNzFgFUaZCgJetpW5tXxb8wERovdjbc=1jS-KxA@mail.gmail.com>
Stephen Oberholtzer <stevie@qrpff.net> writes:
> ... a clean, portable way to create a single case statement that
> handles the final condition.

Hmm, don't we want to say (1) original 0 (success) maps to 1 (2) original 125 maps to 125 (3) anything below 128 in the original maps to 0 and (4) everything else is left intact? Perhaps something as simple like this, taking advantage of the fact that $? won't have anything other than digits?

    ... do something ...
    status=$?
    case $status in
    0) status=1 ;;
    125) : as-is ;;
    ? | ?? | 1[01]? | 12[0-7]) status=0;;
    *) : as-is ;;
    esac

I am still unclear where the need for {SUCCESS_FAIL}_TERM magic comes from, though.

Previous: Stephen Oberholtzer
Message 8 of 8 in “bisect run: allow inverting meaning of exit code”
  1. bisect run: allow inverting meaning of exit codeStephen Oberholtzer, Jan 3, 2020
  2. Jonathan NiederJan 4, 2020
  3. Stephen OberholtzerJan 4, 2020
  4. Junio C HamanoJan 4, 2020
  5. Stephen OberholtzerJan 4, 2020
  6. Junio C HamanoJan 6, 2020
  7. Stephen OberholtzerJan 7, 2020
  8. Junio C HamanoJan 7, 2020

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.