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

Re: [PATCH 1/2] t9832,t2200: avoid using pipes in git commands

From
Amanda Shafack <shafack.likhene@gmail.com>
Date
Oct 18, 2020, 13:57 UTC
Message-ID
<CAGxm6oWT=LG7KczvKaa5ta=LBAkFsHHYsCXLB7tBfn==Z0g9DQ@mail.gmail.com>
In-Reply-To
<CAPig+cQnfcc9W3qE5XkyLiwNyK8Wm2SsAyjzatDWEVUi3s8APw@mail.gmail.com>

Thanks for your feedback, I now have a better understanding. I have made the changes you requested.

On Sun, Oct 18, 2020 at 7:11 AM Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 53 quoted lines
>
> On Sat, Oct 17, 2020 at 12:02 PM Amanda Shafack via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
> > When the upstream of a pipe throws an error, the downstream still
> > executes normally. This happens because the exit code of the upstream
> > in a pipe is ignored. This behavior can make debugging very hard
> > incase a test fails.
>
> To be more precise, we're not worried about difficulty of debugging
> when a Git command is upstream in a pipe. What we are more concerned
> with is that an unexpected failure of the Git command will go
> unnoticed (unless it also happens to produce wrong output which is
> later caught somewhere downstream). By avoiding placing Git upstream
> in a pipe, we can actively catch a failure of the Git command. The
> commit message should focus on that reason instead.
>
> > Also, pipes are prone to deadlocks. If the
> > upstream gets full, the commands downstream will never start.
>
> I don't think this is ever an issue in Git tests, so talking about it
> here probably only muddies the waters, thus makes the commit message
> less precise and more hand-wavy. Dropping this sentence is
> recommended.
>
> > Commit c6f44e1da5 (t9813: avoid using pipes, 2017-01-04) noticed that
> > the exit code of upstream in the pipe is ignored, thus using pipes
> > should be avoided.
>
> There are a lot of commits in the project history which perform this
> sort of transformation, so it's not clear to the reader why this
> particular commit is called out as being important. If it's not, then
> I'd recommend dropping this sentence, as well.
>
> > diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh
> >  test_expect_success '"add -u non-existent" should fail' '
> >         test_must_fail git add -u non-existent &&
> > -       ! (git ls-files | grep "non-existent")
> > +       ! (
> > +               git ls-files >actual &&
> > +               grep "non-existent" actual
> > +       )
> >  '
>
> This transformation appears to be incorrect. See my review of patch
> [2/2] for details.
>
> > diff --git a/t/t9832-unshelve.sh b/t/t9832-unshelve.sh
> > @@ -68,7 +68,8 @@ EOF
> > -               git show refs/remotes/p4-unshelved/$change | grep -q "Further description" &&
> > +               git show refs/remotes/p4-unshelved/$change >actual &&
> > +               grep -q "Further description" actual &&
>
> This transformation looks fine.
-- 
Cheers!

Amanda  Shafack
Previous: Eric SunshineNext: Amanda Shafack via GitGitGadget
Message 7 of 14 in “t9832,t2200: avoid using pipes in git related commands”
  1. 0/2 [Outreachy][Patch v1] t9832,t2200: avoid using pipes in git related commandsAmanda Shafack via GitGitGadget, Oct 17, 2020
  2. 2/2 t2200: modify code syntaxAmanda Shafack via GitGitGadget, Oct 17, 2020
  3. Eric SunshineOct 18, 2020
  4. Amanda ShafackOct 18, 2020
  5. 1/2 t9832,t2200: avoid using pipes in git commandsAmanda Shafack via GitGitGadget, Oct 17, 2020
  6. Eric SunshineOct 18, 2020
  7. Amanda ShafackOct 18, 2020
  8. t9832,t2200: avoid using pipes in git commandsAmanda Shafack via GitGitGadget, Oct 18, 2020
  9. Eric SunshineOct 18, 2020
  10. Junio C HamanoOct 18, 2020
  11. Amanda ShafackOct 18, 2020
  12. Amanda ShafackOct 18, 2020
  13. t2200,t9832: avoid using 'git' upstream in a pipeAmanda Shafack via GitGitGadget, Oct 18, 2020
  14. Junio C HamanoOct 18, 2020

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.