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

Exit status of git show-ref --verify

From
MLMarc Legendre <legendre@anatoscope.com>
Date
Jul 6, 2020, 18:55 UTC
Message-ID
<ggXIwBvE8oQXAL_579a2DJEsrEdPmMHoqEfSmQ31AlmZYRQ7AABmC-pMv1st9ljCXzfw__hnFbNvcBzEWbEfyr7mDSaFYuLv2NM03EDTlhk=@anatoscope.com>
Hi,

I stumbled upon a small discrepancy between the documentation of git-show-ref and its actual behavior. The documentation of the `--verify` flag of git-show-ref says:

  "If nothing matches, 'git show-ref' will return an error code of 1"

Yet it seems to return 1 only if it is also called with --quiet. Tested with the `next` branch:

  [~/dev/git] $ ./git show-ref --verify refs/heads/tagada
  fatal: 'refs/heads/tagada' - not a valid ref
  [~/dev/git] $ echo $?
  128
  [~/dev/git] $ ./git show-ref --quiet --verify refs/heads/tagada
  [~/dev/git] $ echo $?
  1

Regards, Marc Legendre

Message 1 of 1 in “Exit status of git show-ref --verify”
  1. Marc LegendreJul 6, 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.