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

Re: [PATCH v3] t1401: check symbolic-ref failure and --quiet silence on a non-symbolic ref

From
Patrick Steinhardt <ps@pks.im>
Date
Aug 31, 2026, 06:19 UTC
Message-ID
<apUdDyG98D5upbhj@pks.im>
In-Reply-To
<pull.2204.v3.git.1787763107646.gitgitgadget@gmail.com>
On Wed, Aug 26, 2026 at 04:51:47PM +0000, Nikolaus Schuetz via GitGitGadget wrote:
Show 12 quoted lines
> From: Nikolaus Schuetz <nikolauspschuetz@gmail.com>
> 
> git-symbolic-ref(1) documents that reading a name that is not a
> symbolic ref fails, and that --quiet does so silently.  Tests such as
> t2020 and t5621 already rely on "symbolic-ref -q HEAD" failing on a
> detached HEAD, but none checks that the plain form reports the error
> or that --quiet stays silent.
> 
> Assert that a non-symbolic ref fails with the "is not a symbolic ref"
> message, and that --quiet fails with no output.  Use test_must_fail
> rather than pinning the exact exit codes, which are documented but not
> worth freezing in the test.
Documented sure, but the behaviour does not match the documentation:
  git symbolic-ref will exit with status 0 if the contents of the
  symbolic ref were printed correctly, with status 1 if the requested
  name is not a symbolic ref, or 128 if another error occurs.

So in theory we should always exit with 1 in case the refname is not a symbolic reference, no matter whether the user passes "--quiet" or not.

Anyway, we're not asserting the current broken behaviour in the new tests anymore, so I think that this version is good enough. Thanks!

Patrick
Previous: Nikolaus Schuetz via GitGitGadget
Message 11 of 11 in “t1401: test symbolic-ref exit codes on a non-symbolic ref”
  1. t1401: test symbolic-ref exit codes on a non-symbolic refNikolaus Schuetz via GitGitGadget, Aug 13, 2026
  2. Patrick SteinhardtAug 19, 2026
  3. Nikolaus SchuetzAug 20, 2026
  4. t1401: check symbolic-ref exit codes and --quiet silenceNikolaus Schuetz via GitGitGadget, Aug 20, 2026
  5. Patrick SteinhardtAug 24, 2026
  6. Junio C HamanoAug 24, 2026
  7. Phillip WoodAug 24, 2026
  8. Nikolaus SchuetzAug 24, 2026
  9. Junio C HamanoAug 25, 2026
  10. t1401: check symbolic-ref failure and --quiet silence on a non-symbolic refNikolaus Schuetz via GitGitGadget, Aug 26, 2026
  11. Patrick SteinhardtAug 31, 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.