Re: [PATCH v2] t1401: check symbolic-ref exit codes and --quiet silence
From: Patrick Steinhardt <hidden>
Date: 2026-08-24 17:39:27
On Thu, Aug 20, 2026 at 10:20:02PM +0000, Nikolaus Schuetz via GitGitGadget wrote:
From: Nikolaus Schuetz <redacted> git-symbolic-ref(1) documents that reading a name that is not a symbolic ref exits non-zero, 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 pins the exact exit codes or checks that --quiet actually suppresses the diagnostic. Assert that a non-symbolic ref exits 128 with the "is not a symbolic ref" message, and that --quiet instead exits 1 with no output.
I'm still not completely sold that this difference is intentional. As
you mentioned elsewhere, in one code path we use `exit(1)` and in the
other we use `die(...)` to print an error message, which returs 128. But
that to me feels more like nobody noticed that those return different
error codes rather than an intentional difference in design, so casting
that behaviour into stone with new tests feels wrong to me.
I'd suggest that we either:
- Continue not checking for the exact error code.
- Adapt the `exit(1)` to instead be `die(NULL)` so that we have the
same error code across both code paths and then verify that both
have the same error code.
Thanks!
Patrick