All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Nikolaus Schuetz via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Nikolaus Schuetz <nikolauspschuetz@gmail.com>
Subject: Re: [PATCH v2] t1401: check symbolic-ref exit codes and --quiet silence
Date: Mon, 24 Aug 2026 19:39:16 +0200	[thread overview]
Message-ID: <aoyBxOCdAq3qeAvW@pks.im> (raw)
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:
> 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

  reply	other threads:[~2026-08-24 17:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13 21:12 [PATCH] t1401: test symbolic-ref exit codes on a non-symbolic ref Nikolaus Schuetz via GitGitGadget
2026-08-19 11:25 ` Patrick Steinhardt
2026-08-20 15:13   ` Nikolaus Schuetz
2026-08-20 22:20 ` [PATCH v2] t1401: check symbolic-ref exit codes and --quiet silence Nikolaus Schuetz via GitGitGadget
2026-08-24 17:39   ` Patrick Steinhardt [this message]
2026-08-24 18:23     ` Junio C Hamano
2026-08-24 18:35       ` Phillip Wood
2026-08-24 23:05       ` Nikolaus Schuetz
2026-08-25  0:05         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aoyBxOCdAq3qeAvW@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=nikolauspschuetz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.