Skip to content

t1401: test symbolic-ref exit codes on a non-symbolic ref - #2204

Open
nikolauspschuetz wants to merge 1 commit into
gitgitgadget:masterfrom
nikolauspschuetz:ns/t1401-symbolic-ref-quiet
Open

t1401: test symbolic-ref exit codes on a non-symbolic ref#2204
nikolauspschuetz wants to merge 1 commit into
gitgitgadget:masterfrom
nikolauspschuetz:ns/t1401-symbolic-ref-quiet

Conversation

@nikolauspschuetz

Copy link
Copy Markdown

git-symbolic-ref(1) documents that reading a name that is not a symbolic ref exits with a non-zero status, and that --quiet does so silently rather than printing a diagnostic. This exit-code contract was untested.

This adds two tests: querying a non-symbolic ref exits 128 with the usual "is not a symbolic ref" message, and --quiet instead exits 1 with no output.

Test-only; documents existing behaviour, in the spirit of 919eb8a (t1402: check for refs ending with a dot).

@nikolauspschuetz
nikolauspschuetz marked this pull request as ready for review August 13, 2026 21:11
@nikolauspschuetz

Copy link
Copy Markdown
Author

/submit

@gitgitgadget

gitgitgadget Bot commented Aug 13, 2026

Copy link
Copy Markdown

Submitted as pull.2204.git.1786655554197.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-2204/nikolauspschuetz/ns/t1401-symbolic-ref-quiet-v1

To fetch this version to local tag pr-2204/nikolauspschuetz/ns/t1401-symbolic-ref-quiet-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-2204/nikolauspschuetz/ns/t1401-symbolic-ref-quiet-v1

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.

Signed-off-by: Nikolaus Schuetz <nikolauspschuetz@gmail.com>
@nikolauspschuetz
nikolauspschuetz force-pushed the ns/t1401-symbolic-ref-quiet branch from 345e664 to fa9dd1d Compare August 13, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant