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

Re: [PATCH] t1401: test symbolic-ref exit codes on a non-symbolic ref

From
Nikolaus Schuetz <nikolauspschuetz@gmail.com>
Date
Aug 20, 2026, 15:13 UTC
Message-ID
<20260820151325.58087-1-nikolauspschuetz@gmail.com>
In-Reply-To
<aoWSqYvANg5AmuCi@pks.im>
> Out of curiosity, what made you address these gaps in particular? Is
> there any motivation, or are you just picking random things to work on?

Not random -- I've been going through git commands, checking whether the behavior their man pages promise is actually exercised from t/, and filling the gaps. The idea is to pin the documented contract in a test so a later refactor can't quietly change it. git-symbolic-ref(1) spells out both the exit status and the --quiet silence, but neither was tested, so they stood out.

> This is testing the status quo, but what I think would be good to
> research in this context is why the error codes are different in the
> first place.

Agreed it's surprising, though it's not unique to symbolic-ref: git rev-parse --verify --quiet does the same thing (exit 1 and silent, vs a fatal 128 without --quiet). It falls out of how the two paths report in check_symref() (builtin/symbolic-ref.c): the non-quiet path calls die(), which always exits 128, while --quiet can't die() -- that would print -- so it returns 1.

> Do we also want to verify that stdout is empty in both cases?

Great idea. I've revised the added tests to redirect stdout and check for empty stdout in both cases.

Thanks, Nikolaus

Previous: Patrick SteinhardtNext: Nikolaus Schuetz via GitGitGadget
Message 3 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.