git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t1401: test symbolic-ref exit codes on a non-symbolic ref

From
Patrick Steinhardt <ps@pks.im>
Date
Aug 19, 2026, 11:25 UTC
Message-ID
<aoWSqYvANg5AmuCi@pks.im>
In-Reply-To
<pull.2204.git.1786655554197.gitgitgadget@gmail.com>
On Thu, Aug 13, 2026 at 09:12:33PM +0000, Nikolaus Schuetz via GitGitGadget wrote:
Show 5 quoted lines
> From: Nikolaus Schuetz <nikolauspschuetz@gmail.com>
> 
> 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 was not tested.

Out of curiosity, what made you address these gaps in particular? Is there any motivation, or are you just picking random things to work on?

> Check that querying a non-symbolic ref exits 128 with the usual
> "is not a symbolic ref" message, and that --quiet instead exits 1
> with no output.

This is testing the status quo, but what I think would be good to research in this context is why the error codes are different in the first place. I personally find that quite a bit puzzling, as my expectation would be that "--quiet" really only impacts whether we print anything or not. That it also changes the error code is weird.

Show 17 quoted lines
> diff --git a/t/t1401-symbolic-ref.sh b/t/t1401-symbolic-ref.sh
> index a2a7e94716..602db6d080 100755
> --- a/t/t1401-symbolic-ref.sh
> +++ b/t/t1401-symbolic-ref.sh
> @@ -38,6 +38,16 @@ test_expect_success 'symbolic-ref refuses bare sha1' '
>  
>  reset_to_sane
>  
> +test_expect_success 'symbolic-ref reports a non-symbolic ref with exit code 128' '
> +	test_expect_code 128 git symbolic-ref refs/heads/foo 2>err &&
> +	test_grep "is not a symbolic ref" err
> +'
> +
> +test_expect_success 'symbolic-ref -q is silent and exits 1 on a non-symbolic ref' '
> +	test_expect_code 1 git symbolic-ref -q refs/heads/foo 2>err &&
> +	test_must_be_empty err
> +'
Do we also want to verify that stdout is empty in both cases?
Thanks!
Patrick
Previous: Nikolaus Schuetz via GitGitGadgetNext: Nikolaus Schuetz
Message 2 of 11 in “t1401: test symbolic-ref exit codes on a non-symbolic ref”
  1. t1401: test symbolic-ref exit codes on a non-symbolic refNikolaus Schuetz via GitGitGadget, Aug 13, 2026
  2. Patrick SteinhardtAug 19, 2026
  3. Nikolaus SchuetzAug 20, 2026
  4. t1401: check symbolic-ref exit codes and --quiet silenceNikolaus Schuetz via GitGitGadget, Aug 20, 2026
  5. Patrick SteinhardtAug 24, 2026
  6. Junio C HamanoAug 24, 2026
  7. Phillip WoodAug 24, 2026
  8. Nikolaus SchuetzAug 24, 2026
  9. Junio C HamanoAug 25, 2026
  10. t1401: check symbolic-ref failure and --quiet silence on a non-symbolic refNikolaus Schuetz via GitGitGadget, Aug 26, 2026
  11. Patrick SteinhardtAug 31, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.