From: Prathamesh <pc44800@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Christian Couder <christian.couder@gmail.com>,
git <git@vger.kernel.org>, Jon Loeliger <jdl@jdl.com>,
Prathamesh <pc44800@gmail.com>
Subject: Re: [PATCH v3] t2027: avoid using pipes
Date: Wed, 22 Mar 2017 10:33:13 +0530 [thread overview]
Message-ID: <CAME+mvU-4XE1442zMhRpxKjbGcqPEq8t4rc2qQJvyL4vurrkfg@mail.gmail.com> (raw)
In-Reply-To: <20170313065148.10707-1-pc44800@gmail.com>
Are there any other changes which I can do to improve my patch?
Thanks,
Prathamesh
On Mon, Mar 13, 2017 at 12:21 PM, Prathamesh <pc44800@gmail.com> wrote:
> 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>
> ---
> Changed sendemail.name configuration of the .gitconfig file with a single
> name, and also included the leftover files of each test to be removed by
> test_when_finished if the test is passed successfully.
>
> t/t2027-worktree-list.sh | 35 +++++++++++++++++++++--------------
> 1 file changed, 21 insertions(+), 14 deletions(-)
>
> diff --git a/t/t2027-worktree-list.sh b/t/t2027-worktree-list.sh
> index 848da5f36..720063bf0 100755
> --- a/t/t2027-worktree-list.sh
> +++ b/t/t2027-worktree-list.sh
> @@ -20,7 +20,7 @@ test_expect_success 'rev-parse --git-common-dir on main worktree' '
>
> test_expect_success 'rev-parse --git-path objects linked worktree' '
> echo "$(git rev-parse --show-toplevel)/.git/objects" >expect &&
> - test_when_finished "rm -rf linked-tree && git worktree prune" &&
> + test_when_finished "rm -rf linked-tree actual expect && git worktree prune" &&
> git worktree add --detach linked-tree master &&
> git -C linked-tree rev-parse --git-path objects >actual &&
> test_cmp expect actual
> @@ -28,19 +28,21 @@ test_expect_success 'rev-parse --git-path objects linked worktree' '
>
> test_expect_success '"list" all worktrees from main' '
> echo "$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]" >expect &&
> - test_when_finished "rm -rf here && git worktree prune" &&
> + test_when_finished "rm -rf here out actual expect && 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
> '
>
> test_expect_success '"list" all worktrees from linked' '
> echo "$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]" >expect &&
> - test_when_finished "rm -rf here && git worktree prune" &&
> + test_when_finished "rm -rf here out actual expect && 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 -C here worktree list | sed "s/ */ /g" >actual &&
> + git -C here worktree list >out &&
> + sed "s/ */ /g" <out >actual &&
> test_cmp expect actual
> '
>
> @@ -49,7 +51,7 @@ test_expect_success '"list" all worktrees --porcelain' '
> echo "HEAD $(git rev-parse HEAD)" >>expect &&
> echo "branch $(git symbolic-ref HEAD)" >>expect &&
> echo >>expect &&
> - test_when_finished "rm -rf here && git worktree prune" &&
> + test_when_finished "rm -rf here actual expect && git worktree prune" &&
> git worktree add --detach here master &&
> echo "worktree $(git -C here rev-parse --show-toplevel)" >>expect &&
> echo "HEAD $(git rev-parse HEAD)" >>expect &&
> @@ -69,16 +71,17 @@ test_expect_success 'bare repo setup' '
> '
>
> test_expect_success '"list" all worktrees from bare main' '
> - test_when_finished "rm -rf there && git -C bare1 worktree prune" &&
> + test_when_finished "rm -rf there out actual expect && git -C bare1 worktree prune" &&
> git -C bare1 worktree add --detach ../there master &&
> echo "$(pwd)/bare1 (bare)" >expect &&
> echo "$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)" >>expect &&
> - git -C bare1 worktree list | sed "s/ */ /g" >actual &&
> + git -C bare1 worktree list >out &&
> + sed "s/ */ /g" <out >actual &&
> test_cmp expect actual
> '
>
> test_expect_success '"list" all worktrees --porcelain from bare main' '
> - test_when_finished "rm -rf there && git -C bare1 worktree prune" &&
> + test_when_finished "rm -rf there actual expect && git -C bare1 worktree prune" &&
> git -C bare1 worktree add --detach ../there master &&
> echo "worktree $(pwd)/bare1" >expect &&
> echo "bare" >>expect &&
> @@ -92,11 +95,12 @@ test_expect_success '"list" all worktrees --porcelain from bare main' '
> '
>
> test_expect_success '"list" all worktrees from linked with a bare main' '
> - test_when_finished "rm -rf there && git -C bare1 worktree prune" &&
> + test_when_finished "rm -rf there out actual expect && git -C bare1 worktree prune" &&
> git -C bare1 worktree add --detach ../there master &&
> echo "$(pwd)/bare1 (bare)" >expect &&
> echo "$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)" >>expect &&
> - git -C there worktree list | sed "s/ */ /g" >actual &&
> + git -C there worktree list >out &&
> + sed "s/ */ /g" <out >actual &&
> test_cmp expect actual
> '
>
> @@ -118,9 +122,11 @@ 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 &&
> grep -F "(error)" actual.2
> )
> '
> @@ -134,7 +140,8 @@ 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
>
next prev parent reply other threads:[~2017-03-22 5:03 UTC|newest]
Thread overview: 13+ 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
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 [this message]
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
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAME+mvU-4XE1442zMhRpxKjbGcqPEq8t4rc2qQJvyL4vurrkfg@mail.gmail.com \
--to=pc44800@gmail.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jdl@jdl.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).