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

Re: [GSOC][PATCH v3] t3701: don't lose "git" exit codes in test scripts

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Apr 2, 2023, 17:17 UTC
Message-ID
<CAPig+cRs7u2gZC_Tb1Zx4UWn-Ut5yB4OW4RU3kJrT-bR73bfQA@mail.gmail.com>
In-Reply-To
<20230402113607.2394-1-edwinfernando734@gmail.com>

On Sun, Apr 2, 2023 at 7:36 AM Edwin Fernando <edwinfernando734@gmail.com> wrote:

Show 13 quoted lines
> Exit codes are lost due to piping and command substitution:
>
> - "git ... | <command>"
> - "<command> $(git ... )"
>
> Fix these issues using the intermediate step of writing output to file.
>
> Signed-off-by: Edwin Fernando <edwinfernando734@gmail.com>
> ---
> Changes from v2:
> - use git rebase to squash commit history,
>   and diff with upstream commit for review
> - use present tense for code before the commit.
Thanks. The patch is looking a lot better. One comment, though...
Show 12 quoted lines
> diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
> @@ -311,9 +315,11 @@ test_expect_success FILEMODE 'stage mode and hunk' '
>         printf "y\\ny\\n" | git add -p &&
> -       git diff --cached file | grep "new mode" &&
> -       git diff --cached file | grep "+content" &&
> -       test -z "$(git diff file)"
> +       git diff --cached file >diff &&
> +       grep "new mode" diff &&
> +       grep "+content" diff &&
> +       git diff file >diff &&
> +       test_must_be_empty diff
>  '

The other changes in your patch are worthwhile, but it seems that you have based this patch on an outdated copy of the repository. This particular change had already been made by 9fdc79ecba (tests: don't lose misc "git" exit codes, 2023-02-06) a couple months ago[1].

So, you'll want to update your repository to the latest available from Junio, re-roll using "master" as a base for the patch, and drop this change while keeping the others.

[1]: https://github.com/git/git/commit/9fdc79ecba0f4a3ef885f1409d2db5a1dbabd649
Previous: Edwin FernandoNext: Edwin Fernando
Message 8 of 13 in “Avoid suppression of git's exit code in tests”
  1. Edwin FernandoMar 26, 2023
  2. [GSOC][PATCH 1/1] t3701: Avoid suppression of exit status of gitEdwin Fernando, Mar 26, 2023
  3. Andrei RybakMar 26, 2023
  4. Eric SunshineMar 27, 2023
  5. [GSOC][PATCH v2] t3701: don't lose "git" exit codes in test scriptsEdwin Fernando, Apr 1, 2023
  6. Andrei RybakApr 2, 2023
  7. [GSOC][PATCH v3] t3701: don't lose "git" exit codes in test scriptsEdwin Fernando, Apr 2, 2023
  8. Eric SunshineApr 2, 2023
  9. [GSOC][PATCH v4] t3701: don't lose "git" exit codes in test scriptsEdwin Fernando, Apr 2, 2023
  10. Eric SunshineApr 3, 2023
  11. Edwin FernandoApr 3, 2023
  12. Edwin FernandoApr 3, 2023
  13. Eric SunshineApr 3, 2023

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.