Re: [PATCH v2] t1401: check symbolic-ref exit codes and --quiet silence
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Aug 24, 2026, 17:39 UTC
- Message-ID
- <aoyBxOCdAq3qeAvW@pks.im>
- In-Reply-To
- <pull.2204.v2.git.1787264402361.gitgitgadget@gmail.com>
On Thu, Aug 20, 2026 at 10:20:02PM +0000, Nikolaus Schuetz via GitGitGadget wrote:
Show 10 quoted lines
> From: Nikolaus Schuetz <nikolauspschuetz@gmail.com> > > 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