All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Couder <christian.couder@gmail.com>
To: Prathamesh Chavan <pc44800@gmail.com>
Cc: git <git@vger.kernel.org>, Jon Loeliger <jdl@jdl.com>
Subject: Re: [PATCH] t2027: avoid using pipes
Date: Thu, 9 Mar 2017 21:15:59 +0100	[thread overview]
Message-ID: <CAP8UFD1xQnR8aWVRqu1_k2qhEcR2fOdyHT51aUyq9EdFg7f7Xw@mail.gmail.com> (raw)
In-Reply-To: <20170309190310.30589-1-pc44800@gmail.com>

On Thu, Mar 9, 2017 at 8:03 PM, Prathamesh Chavan <pc44800@gmail.com> wrote:
> 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)

>  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
>  '

[...]

> @@ -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.

>                 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
>

  reply	other threads:[~2017-03-09 20:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-09 19:03 [PATCH] t2027: avoid using pipes Prathamesh Chavan
2017-03-09 20:15 ` Christian Couder [this message]
2017-03-10  8:36   ` [Patch v2] " Prathamesh Chavan
2017-03-13  3:10     ` Junio C Hamano
2017-03-13  6:36       ` [PATCH v3] " pc44800
2017-03-13  6:51         ` Prathamesh
2017-03-22  5:03           ` Prathamesh
2017-03-23 10:15           ` Christian Couder
2017-03-24  8:27             ` [GSoC][PATCH v4] " Prathamesh Chavan
2017-03-24 11:58               ` Torsten Bögershausen
2017-03-24 12:04             ` Prathamesh Chavan
2017-04-03 19:40               ` Stefan Beller
2017-04-03 21:35                 ` [GSoC][PATCH v5] " Prathamesh Chavan
  -- strict thread matches above, loose matches on Subject: below --
2017-03-09 12:30 [PATCH v2] " Christian Couder
2017-03-09 19:18 ` [PATCH] " Prathamesh Chavan
2017-03-08 15:13 Prathamesh Chavan
2017-03-08 15:44 ` Jon Loeliger
2017-03-08 21:38   ` Prathamesh Chavan
2017-03-08 22:13     ` Prathamesh Chavan
2017-03-09  8:08 ` Christian Couder
2017-03-09  8:56   ` Prathamesh Chavan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAP8UFD1xQnR8aWVRqu1_k2qhEcR2fOdyHT51aUyq9EdFg7f7Xw@mail.gmail.com \
    --to=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jdl@jdl.com \
    --cc=pc44800@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.