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

Re: [PATCH] t6423: fix suppression of Git’s exit code in tests

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Feb 2, 2025, 13:35 UTC
Message-ID
<CAPig+cSBi05Kq1ohxQJ8BwTsis++fAAaVCd8Ep8k=8cLS74jsw@mail.gmail.com>
In-Reply-To
<20250202120926.322417-1-ayu.chandekar@gmail.com>
On Sun, Feb 2, 2025 at 7:09 AM ayu-ch <ayu.chandekar@gmail.com> wrote:
Show 14 quoted lines
> Some test in t6423 supress Git's exit code, which can cause test
> failures go unnoticed. Specifically using git <subcommand> |
> <other-command> masks potential failures of the Git command.
>
> This commit ensures that Git's exit status is correctly propogated by:
> - Avoiding pipes that suppress exit codes.
>
> Signed-off-by: Ayush Chandekar <ayu.chandekar@gmail.com>
> ---
> diff --git a/t/t6423-merge-rename-directories.sh b/t/t6423-merge-rename-directories.sh
> @@ -5071,7 +5071,8 @@ test_expect_success '12i: Directory rename causes rename-to-self' '
> -               git ls-files | uniq >tracked &&
> +               git ls-files >actual &&
> +               uniq <actual >tracked &&

I was curious if the project has a preference between `uniq filename` and `uniq <filename`, but apparently we haven't:

    % git grep 'uniq <' -- t | wc -l
    2
    git grep 'uniq [a-z0-9]' -- t | wc -l
    2

Though there does seem to be a global preference in the project to specify the filename directly to the command rather than redirecting from stdin. For instance:

    % git grep 'sort <' -- t | wc -l
    54
    % git grep 'sort [a-z0-9]' -- t | wc -l
    140

In any case, what you have here is probably fine, so no need to reroll just for this.

Previous: Meet SoniNext: Junio C Hamano
Message 3 of 9 in “t6423: fix suppression of Git���s exit code in tests”
  1. t6423: fix suppression of Git���s exit code in testsayu-ch, Feb 2, 2025
  2. Meet SoniFeb 2, 2025
  3. Eric SunshineFeb 2, 2025
  4. Junio C HamanoFeb 3, 2025
  5. Ayush ChandekarFeb 4, 2025
  6. Junio C HamanoFeb 4, 2025
  7. [GSOC][PATCH v2] t6422: avoid suppressing Git’s exit code in testsAyush Chandekar, Feb 5, 2025
  8. Junio C HamanoFeb 5, 2025
  9. Ayush ChandekarFeb 6, 2025

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.