Git development
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Nikolaus Schuetz via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Phillip Wood <phillip.wood123@gmail.com>,
	Nikolaus Schuetz <nikolauspschuetz@gmail.com>
Subject: Re: [PATCH v3] t1401: check symbolic-ref failure and --quiet silence on a non-symbolic ref
Date: Mon, 31 Aug 2026 08:19:59 +0200	[thread overview]
Message-ID: <apUdDyG98D5upbhj@pks.im> (raw)
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:
> 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

      reply	other threads:[~2026-08-31  6:20 UTC|newest]

Thread overview: 11+ 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
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
2026-08-26 16:51 ` [PATCH v3] t1401: check symbolic-ref failure and --quiet silence on a non-symbolic ref Nikolaus Schuetz via GitGitGadget
2026-08-31  6:19   ` Patrick Steinhardt [this message]

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=apUdDyG98D5upbhj@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=nikolauspschuetz@gmail.com \
    --cc=phillip.wood123@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox