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

Re: [PATCH] t2027: avoid using pipes

From
Christian Couder <christian.couder@gmail.com>
Date
Mar 9, 2017, 20:15 UTC
Message-ID
<CAP8UFD1xQnR8aWVRqu1_k2qhEcR2fOdyHT51aUyq9EdFg7f7Xw@mail.gmail.com>
In-Reply-To
<20170309190310.30589-1-pc44800@gmail.com>
On Thu, Mar 9, 2017 at 8:03 PM, Prathamesh Chavan <pc44800@gmail.com> wrote:
Show 10 quoted lines
> From: Prathamesh <pc44800@gmail.com>
>
> Whenever a git command is present in the upstream of a pipe, its failure
> gets masked by piping and hence it should be avoided for testing the
> upstream git command. By writing out the output of the git command to
> a file, we can test the exit codes of both the commands as a failure exit
> code in any command is able to stop the && chain.
>
> Signed-off-by: Prathamesh <pc44800@gmail.com>
> ---

When you post a new version of a patch or a patch series, could you do the following:

- add v2 or v3, or ... after "PATCH" in the subject, so that we know
which version it is (see the mailing list archive and the format-patch
documentation to see how it should appear and how to do it)
- tell what you changed since the previous version, and maybe also why
you made those changes, if it has not already been explained or
discussed (you can do it after the "---" above and before the file
stats below, or in a separate email replying to the patch, or in the
cover letter of the patch series if you are sending a patch series)
Show 16 quoted lines
>  t/t2027-worktree-list.sh | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/t/t2027-worktree-list.sh b/t/t2027-worktree-list.sh
> index 848da5f36..d8b3907e0 100755
> --- a/t/t2027-worktree-list.sh
> +++ b/t/t2027-worktree-list.sh
> @@ -31,7 +31,8 @@ test_expect_success '"list" all worktrees from main' '
>         test_when_finished "rm -rf here && git worktree prune" &&
>         git worktree add --detach here master &&
>         echo "$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)" >>expect &&
> -       git worktree list | sed "s/  */ /g" >actual &&
> +       git worktree list >out &&
> +       sed "s/  */ /g" <out >actual &&
>         test_cmp expect actual
>  '
[...]
Show 9 quoted lines
> @@ -118,9 +122,9 @@ test_expect_success 'broken main worktree still at the top' '
>                 cd linked &&
>                 echo "worktree $(pwd)" >expected &&
>                 echo "ref: .broken" >../.git/HEAD &&
> -               git worktree list --porcelain | head -n 3 >actual &&
> +               git worktree list --porcelain >out && head -n 3 out >actual &&
>                 test_cmp ../expected actual &&
> -               git worktree list | head -n 1 >actual.2 &&
> +               git worktree list >out && head -n 1 out >actual.2 &&

I think it would be better if the 'head' commands above and the 'grep' command below were also on their own line.

Show 15 quoted lines
>                 grep -F "(error)" actual.2
>         )
>  '
> @@ -134,7 +138,7 @@ test_expect_success 'linked worktrees are sorted' '
>                 test_commit new &&
>                 git worktree add ../first &&
>                 git worktree add ../second &&
> -               git worktree list --porcelain | grep ^worktree >actual
> +               git worktree list --porcelain >out && grep ^worktree out >actual
>         ) &&
>         cat >expected <<-EOF &&
>         worktree $(pwd)/sorted/main
> --
> 2.11.0
>
Previous: Prathamesh ChavanNext: Prathamesh Chavan
Message 2 of 13 in “t2027: avoid using pipes”
  1. t2027: avoid using pipesPrathamesh Chavan, Mar 9, 2017
  2. Christian CouderMar 9, 2017
  3. t2027: avoid using pipesPrathamesh Chavan, Mar 10, 2017
  4. Junio C HamanoMar 13, 2017
  5. t2027: avoid using pipespc44800@gmail.com, Mar 13, 2017
  6. t2027: avoid using pipesPrathamesh, Mar 13, 2017
  7. PrathameshMar 22, 2017
  8. Christian CouderMar 23, 2017
  9. [GSoC][PATCH v4] t2027: avoid using pipesPrathamesh Chavan, Mar 24, 2017
  10. Torsten BögershausenMar 24, 2017
  11. [GSoC][PATCH v4] t2027: avoid using pipesPrathamesh Chavan, Mar 24, 2017
  12. Stefan BellerApr 3, 2017
  13. [GSoC][PATCH v5] t2027: avoid using pipesPrathamesh Chavan, Apr 3, 2017

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.