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

Re: [PATCH 2/2] t0030-t0050: avoid pipes with Git on LHS

From
Shubham Mishra <shivam828787@gmail.com>
Date
Feb 26, 2022, 12:09 UTC
Message-ID
<CAC316V4a37rsVpemARu17h2e0bj=ahsWOxjBEwO=BiWou+4aBw@mail.gmail.com>
In-Reply-To
<220224.86o82wab31.gmgdl@evledraar.gmail.com>
Hi,
Thanks for Reviewing.
Show 33 quoted lines
> You're modifying some tests here that are using some old coding style,
> so maybe it's better to adjust it while we're at it?
>
> Also I think this would be a lot nicer with test_stdout_line_count and a
> helper to deal with that pritnf, e.g.:
>
>         diff --git a/t/t0030-stripspace.sh b/t/t0030-stripspace.sh
>         index ae1ca380c1a..d48a3579511 100755
>         --- a/t/t0030-stripspace.sh
>         +++ b/t/t0030-stripspace.sh
>         @@ -223,12 +223,15 @@ test_expect_success \
>              test_cmp expect actual
>          '
>
>         -test_expect_success \
>         -    'text without newline at end should end with newline' '
>         -    test $(printf "$ttt" | git stripspace | wc -l) -gt 0 &&
>         -    test $(printf "$ttt$ttt" | git stripspace | wc -l) -gt 0 &&
>         -    test $(printf "$ttt$ttt$ttt" | git stripspace | wc -l) -gt 0 &&
>         -    test $(printf "$ttt$ttt$ttt$ttt" | git stripspace | wc -l) -gt 0
>         +printf_git_stripspace () {
>         +       printf "$1" | git stripspace
>         +}
>         +
>         +test_expect_success 'text without newline at end should end with newline' '
>         +       test_stdout_line_count -gt 0 printf_git_stripspace "$ttt" &&
>         +       test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt" &&
>         +       test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt$ttt" &&
>         +       test_stdout_line_count -gt 0 printf_git_stripspace "$ttt$ttt$ttt$ttt"
>          '
>
>          # text plus spaces at the end:
>

it makes sense to improve this code as we are touching it, this way looks much better. I will implement it.

> This is not on you, but generally we don't pipe "grep" to >/dev/null,
> and just let the --verbose option do its work.

I don't think I understood this, I guess you are talking about the "-v" flag that stands for invert match? I didn't find "--verbose" with grep. Please correct me if I am wrong.

> With/without that change you no longer need the () subshell here.
sure.

Thanks, Shubham

Previous: Ævar Arnfjörð BjarmasonNext: Taylor Blau
Message 5 of 19 in “Subject: [PATCH 0/2] [GSoC][PATCH 0/2] t0000-t0050: avoid pipes with Git on LHS”
  1. 0/2 Subject: [PATCH 0/2] [GSoC][PATCH 0/2] t0000-t0050: avoid pipes with Git on LHSShubham Mishra, Feb 24, 2022
  2. 1/2 t0001-t0028: avoid pipes with Git on LHSShubham Mishra, Feb 24, 2022
  3. 2/2 t0030-t0050: avoid pipes with Git on LHSShubham Mishra, Feb 24, 2022
  4. Ævar Arnfjörð BjarmasonFeb 24, 2022
  5. Shubham MishraFeb 26, 2022
  6. Taylor BlauFeb 26, 2022
  7. [GSoC] [PATCH v2 0/2] avoid pipes with Git on LHSShubham Mishra, Feb 27, 2022
  8. 1/2 t0001-t0028: avoid pipes with Git on LHSShubham Mishra, Feb 27, 2022
  9. Johannes SixtFeb 27, 2022
  10. Shubham MishraMar 3, 2022
  11. 2/2 t0030-t0050: avoid pipes with Git on LHSShubham Mishra, Feb 27, 2022
  12. Johannes SixtFeb 27, 2022
  13. Shubham MishraFeb 24, 2022
  14. Taylor BlauFeb 26, 2022
  15. [GSoC] [PATCH v3 0/2] avoid pipes with Git on LHSShubham Mishra, Mar 12, 2022
  16. 1/2 t0001-t0028: avoid pipes with Git on LHSShubham Mishra, Mar 12, 2022
  17. 2/2 t0030-t0050: avoid pipes with Git on LHSShubham Mishra, Mar 12, 2022
  18. Johannes SixtMar 12, 2022
  19. Shubham MishraMar 12, 2022

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.