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

Re: [PATCH] remote: add meaningful exit code on missing/existing

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 26, 2020, 18:29 UTC
Message-ID
<xmqqlffset85.fsf@gitster.c.googlers.com>
In-Reply-To
<20201026144825.26537-1-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
Show 16 quoted lines
> Change the exit code for the likes of "git remote add/rename" to exit
> with 2 if the remote in question doesn't exist, and 3 if it
> does. Before we'd just die() and exit with the general 128 exit code.
>
> This changes the output message from e.g.:
>
>     fatal: remote origin already exists.
>
> To:
>
>     error: remote origin already exists.
>
> Which I believe is a feature, since we generally use "fatal" for the
> generic errors, and "error" for the more specific ones with a custom
> exit code, but this part of the change may break code that already
> relies on stderr parsing (not that we ever supported that...).

Sounds like a worthy goal. One thing that disturbs me somewhat, which the time will solve without any of our effort, is how the calling scripts and machinery decides when they can start relying on the exit codes. A "git remote tell-me-what-you-can-do" command that may or may not say "exitcode" to its standard output is added? "test $(git version) -ge 2.30 || old_way"?

The changes to the code all looked quite straight-forward and the tests look sensible, too.

Thanks.
Previous: Eric SunshineNext: Jeff King
Message 3 of 7 in “remote: add meaningful exit code on missing/existing”
  1. remote: add meaningful exit code on missing/existingÆvar Arnfjörð Bjarmason, Oct 26, 2020
  2. Eric SunshineOct 26, 2020
  3. Junio C HamanoOct 26, 2020
  4. Jeff KingOct 26, 2020
  5. Junio C HamanoOct 26, 2020
  6. remote: add meaningful exit code on missing/existingÆvar Arnfjörð Bjarmason, Oct 27, 2020
  7. Bert WesargOct 26, 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.