{"thread":{"id":"45330","subject":"[PATCH] t2027: avoid using pipes","startedAt":"2017-03-09T19:00:29Z","lastAt":"2017-04-03T21:36:38Z","messageCount":13,"participants":["Prathamesh Chavan","Christian Couder","Junio C Hamano","pc44800@gmail.com","Prathamesh","Torsten Bögershausen","Stefan Beller"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"313666","messageId":"20170309190310.30589-1-pc44800@gmail.com","threadId":"45330","inReplyTo":null,"subject":"[PATCH] t2027: avoid using pipes","fromName":"Prathamesh Chavan","fromEmail":"pc44800@gmail.com","sentAt":"2017-03-09T19:03:10Z","receivedAt":"2017-03-09T19:00:29Z","isPatch":true,"sender":{"key":"pc44800@gmail.com","avatar":"https://avatars.githubusercontent.com/u/17272661?v=4"},"body":"From: Prathamesh <pc44800@gmail.com>\n\nWhenever a git command is present in the upstream of a pipe, its failure\ngets masked by piping and hence it should be avoided for testing the\nupstream git command. By writing out the output of the git command to\na file, we can test the exit codes of both the commands as a failure exit\ncode in any command is able to stop the && chain.\n\nSigned-off-by: Prathamesh <pc44800@gmail.com>\n---\n t/t2027-worktree-list.sh | 18 +++++++++++-------\n 1 file changed, 11 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t2027-worktree-list.sh b/t/t2027-worktree-list.sh\nindex 848da5f36..d8b3907e0 100755\n--- a/t/t2027-worktree-list.sh\n+++ b/t/t2027-worktree-list.sh\n@@ -31,7 +31,8 @@ test_expect_success '\"list\" all worktrees from main' '\n \ttest_when_finished \"rm -rf here && git worktree prune\" &&\n \tgit worktree add --detach here master &&\n \techo \"$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -40,7 +41,8 @@ test_expect_success '\"list\" all worktrees from linked' '\n \ttest_when_finished \"rm -rf here && git worktree prune\" &&\n \tgit worktree add --detach here master &&\n \techo \"$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C here worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C here worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -73,7 +75,8 @@ test_expect_success '\"list\" all worktrees from bare main' '\n \tgit -C bare1 worktree add --detach ../there master &&\n \techo \"$(pwd)/bare1 (bare)\" >expect &&\n \techo \"$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C bare1 worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C bare1 worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -96,7 +99,8 @@ test_expect_success '\"list\" all worktrees from linked with a bare main' '\n \tgit -C bare1 worktree add --detach ../there master &&\n \techo \"$(pwd)/bare1 (bare)\" >expect &&\n \techo \"$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C there worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C there worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -118,9 +122,9 @@ test_expect_success 'broken main worktree still at the top' '\n \t\tcd linked &&\n \t\techo \"worktree $(pwd)\" >expected &&\n \t\techo \"ref: .broken\" >../.git/HEAD &&\n-\t\tgit worktree list --porcelain | head -n 3 >actual &&\n+\t\tgit worktree list --porcelain >out && head -n 3 out >actual &&\n \t\ttest_cmp ../expected actual &&\n-\t\tgit worktree list | head -n 1 >actual.2 &&\n+\t\tgit worktree list >out && head -n 1 out >actual.2 &&\n \t\tgrep -F \"(error)\" actual.2\n \t)\n '\n@@ -134,7 +138,7 @@ test_expect_success 'linked worktrees are sorted' '\n \t\ttest_commit new &&\n \t\tgit worktree add ../first &&\n \t\tgit worktree add ../second &&\n-\t\tgit worktree list --porcelain | grep ^worktree >actual\n+\t\tgit worktree list --porcelain >out && grep ^worktree out >actual\n \t) &&\n \tcat >expected <<-EOF &&\n \tworktree $(pwd)/sorted/main\n-- \n2.11.0\n\n"},{"id":"313673","messageId":"CAP8UFD1xQnR8aWVRqu1_k2qhEcR2fOdyHT51aUyq9EdFg7f7Xw@mail.gmail.com","threadId":"45330","inReplyTo":"20170309190310.30589-1-pc44800@gmail.com","subject":"Re: [PATCH] t2027: avoid using pipes","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2017-03-09T20:15:59Z","receivedAt":"2017-03-09T20:16:17Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Thu, Mar 9, 2017 at 8:03 PM, Prathamesh Chavan <pc44800@gmail.com> wrote:\n> From: Prathamesh <pc44800@gmail.com>\n>\n> Whenever a git command is present in the upstream of a pipe, its failure\n> gets masked by piping and hence it should be avoided for testing the\n> upstream git command. By writing out the output of the git command to\n> a file, we can test the exit codes of both the commands as a failure exit\n> code in any command is able to stop the && chain.\n>\n> Signed-off-by: Prathamesh <pc44800@gmail.com>\n> ---\n\nWhen you post a new version of a patch or a patch series, could you do\nthe following:\n\n- add v2 or v3, or ... after \"PATCH\" in the subject, so that we know\nwhich version it is (see the mailing list archive and the format-patch\ndocumentation to see how it should appear and how to do it)\n- tell what you changed since the previous version, and maybe also why\nyou made those changes, if it has not already been explained or\ndiscussed (you can do it after the \"---\" above and before the file\nstats below, or in a separate email replying to the patch, or in the\ncover letter of the patch series if you are sending a patch series)\n\n>  t/t2027-worktree-list.sh | 18 +++++++++++-------\n>  1 file changed, 11 insertions(+), 7 deletions(-)\n>\n> diff --git a/t/t2027-worktree-list.sh b/t/t2027-worktree-list.sh\n> index 848da5f36..d8b3907e0 100755\n> --- a/t/t2027-worktree-list.sh\n> +++ b/t/t2027-worktree-list.sh\n> @@ -31,7 +31,8 @@ test_expect_success '\"list\" all worktrees from main' '\n>         test_when_finished \"rm -rf here && git worktree prune\" &&\n>         git worktree add --detach here master &&\n>         echo \"$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n> -       git worktree list | sed \"s/  */ /g\" >actual &&\n> +       git worktree list >out &&\n> +       sed \"s/  */ /g\" <out >actual &&\n>         test_cmp expect actual\n>  '\n\n[...]\n\n> @@ -118,9 +122,9 @@ test_expect_success 'broken main worktree still at the top' '\n>                 cd linked &&\n>                 echo \"worktree $(pwd)\" >expected &&\n>                 echo \"ref: .broken\" >../.git/HEAD &&\n> -               git worktree list --porcelain | head -n 3 >actual &&\n> +               git worktree list --porcelain >out && head -n 3 out >actual &&\n>                 test_cmp ../expected actual &&\n> -               git worktree list | head -n 1 >actual.2 &&\n> +               git worktree list >out && head -n 1 out >actual.2 &&\n\nI think it would be better if the 'head' commands above and the 'grep'\ncommand below were also on their own line.\n\n>                 grep -F \"(error)\" actual.2\n>         )\n>  '\n> @@ -134,7 +138,7 @@ test_expect_success 'linked worktrees are sorted' '\n>                 test_commit new &&\n>                 git worktree add ../first &&\n>                 git worktree add ../second &&\n> -               git worktree list --porcelain | grep ^worktree >actual\n> +               git worktree list --porcelain >out && grep ^worktree out >actual\n>         ) &&\n>         cat >expected <<-EOF &&\n>         worktree $(pwd)/sorted/main\n> --\n> 2.11.0\n>\n"},{"id":"313740","messageId":"20170310083611.7374-1-pc44800@gmail.com","threadId":"45330","inReplyTo":"CAP8UFD1xQnR8aWVRqu1_k2qhEcR2fOdyHT51aUyq9EdFg7f7Xw@mail.gmail.com","subject":"[Patch v2] t2027: avoid using pipes","fromName":"Prathamesh Chavan","fromEmail":"pc44800@gmail.com","sentAt":"2017-03-10T08:36:11Z","receivedAt":"2017-03-10T08:38:07Z","isPatch":true,"sender":{"key":"pc44800@gmail.com","avatar":"https://avatars.githubusercontent.com/u/17272661?v=4"},"body":"From: Prathamesh <pc44800@gmail.com>\n\nWhenever a git command is present in the upstream of a pipe, its failure\ngets masked by piping and hence it should be avoided for testing the\nupstream git command. By writing out the output of the git command to\na file, we can test the exit codes of both the commands as a failure exit\ncode in any command is able to stop the && chain.\n\nSigned-off-by: Prathamesh <pc44800@gmail.com>\n---\nNew version of patch updated to include suggested change of add the git\ncommand which was above the grep command on a new line. Also some more\nchanges similar to the above change were made.\nAnother reason for a newer version in to improvise the previous mistake\nof not including the patch version, as well as getting more familiar with\nthe submitting patch process.\n\n\n t/t2027-worktree-list.sh | 21 ++++++++++++++-------\n 1 file changed, 14 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t2027-worktree-list.sh b/t/t2027-worktree-list.sh\nindex 848da5f36..a3e77fee5 100755\n--- a/t/t2027-worktree-list.sh\n+++ b/t/t2027-worktree-list.sh\n@@ -31,7 +31,8 @@ test_expect_success '\"list\" all worktrees from main' '\n \ttest_when_finished \"rm -rf here && git worktree prune\" &&\n \tgit worktree add --detach here master &&\n \techo \"$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -40,7 +41,8 @@ test_expect_success '\"list\" all worktrees from linked' '\n \ttest_when_finished \"rm -rf here && git worktree prune\" &&\n \tgit worktree add --detach here master &&\n \techo \"$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C here worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C here worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -73,7 +75,8 @@ test_expect_success '\"list\" all worktrees from bare main' '\n \tgit -C bare1 worktree add --detach ../there master &&\n \techo \"$(pwd)/bare1 (bare)\" >expect &&\n \techo \"$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C bare1 worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C bare1 worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -96,7 +99,8 @@ test_expect_success '\"list\" all worktrees from linked with a bare main' '\n \tgit -C bare1 worktree add --detach ../there master &&\n \techo \"$(pwd)/bare1 (bare)\" >expect &&\n \techo \"$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C there worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C there worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -118,9 +122,11 @@ test_expect_success 'broken main worktree still at the top' '\n \t\tcd linked &&\n \t\techo \"worktree $(pwd)\" >expected &&\n \t\techo \"ref: .broken\" >../.git/HEAD &&\n-\t\tgit worktree list --porcelain | head -n 3 >actual &&\n+\t\tgit worktree list --porcelain >out &&\n+\t\thead -n 3 out >actual &&\n \t\ttest_cmp ../expected actual &&\n-\t\tgit worktree list | head -n 1 >actual.2 &&\n+\t\tgit worktree list >out &&\n+\t\thead -n 1 out >actual.2 &&\n \t\tgrep -F \"(error)\" actual.2\n \t)\n '\n@@ -134,7 +140,8 @@ test_expect_success 'linked worktrees are sorted' '\n \t\ttest_commit new &&\n \t\tgit worktree add ../first &&\n \t\tgit worktree add ../second &&\n-\t\tgit worktree list --porcelain | grep ^worktree >actual\n+\t\tgit worktree list --porcelain >out &&\n+\t\tgrep ^worktree out >actual\n \t) &&\n \tcat >expected <<-EOF &&\n \tworktree $(pwd)/sorted/main\n-- \n2.11.0\n\n"},{"id":"313874","messageId":"xmqqk27tub1g.fsf@gitster.mtv.corp.google.com","threadId":"45330","inReplyTo":"20170310083611.7374-1-pc44800@gmail.com","subject":"Re: [Patch v2] t2027: avoid using pipes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-03-13T03:10:19Z","receivedAt":"2017-03-13T03:10:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Prathamesh Chavan <pc44800@gmail.com> writes:\n\n> From: Prathamesh <pc44800@gmail.com>\n\nYour e-mail header says \n\n\tFrom: Prathamesh Chavan <pc44800@gmail.com>\n\nand you probably have \"[user] name = Prathamesh\" somewhere in your\nconfig, and I think that is why we see the above line in format-patch\noutput and on your sign-off.  If you really prefer to be known as a\nperson with a single name (without Chavan) to the community, that is\nfine, but if that is not the case, perhaps you'd want to review your\nconfig and fix this.\n\n> Whenever a git command is present in the upstream of a pipe, its failure\n> gets masked by piping and hence it should be avoided for testing the\n> upstream git command. By writing out the output of the git command to\n> a file, we can test the exit codes of both the commands as a failure exit\n> code in any command is able to stop the && chain.\n\nOK.\n\n> Signed-off-by: Prathamesh <pc44800@gmail.com>\n\n> diff --git a/t/t2027-worktree-list.sh b/t/t2027-worktree-list.sh\n> index 848da5f36..a3e77fee5 100755\n> --- a/t/t2027-worktree-list.sh\n> +++ b/t/t2027-worktree-list.sh\n> @@ -31,7 +31,8 @@ test_expect_success '\"list\" all worktrees from main' '\n>  \ttest_when_finished \"rm -rf here && git worktree prune\" &&\n>  \tgit worktree add --detach here master &&\n>  \techo \"$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n> -\tgit worktree list | sed \"s/  */ /g\" >actual &&\n> +\tgit worktree list >out &&\n> +\tsed \"s/  */ /g\" <out >actual &&\n>  \ttest_cmp expect actual\n>  '\n\nWe'll have \"out\" as a new leftover file, but it probably would not\nmake too much of a difference.  We already leave 'expect' and 'actual'\nin the working tree as known crufts.  \n\nJust FYI, if you want to clean them, there is already when_finished\nin this piece (and others) so you could do\n\n    -test_when_finished \"rm -rf here && git worktree prune\" &&\n    -test_when_finished \"rm -rf here out actual expect && git worktree prune\" &&\n\nWhen a test fails, when_finished is not run, so this will not\ninterfere with necessary debugging effort when/if somebody breaks\n\"git worktree\" and this test starts failing.\n\n"},{"id":"313876","messageId":"58c63e10.5585620a.a224d.11cd@mx.google.com","threadId":"45330","inReplyTo":"xmqqk27tub1g.fsf@gitster.mtv.corp.google.com","subject":"[PATCH v3] t2027: avoid using pipes","fromName":"","fromEmail":"pc44800@gmail.com","sentAt":"2017-03-13T06:36:48Z","receivedAt":"2017-03-13T06:37:11Z","isPatch":true,"sender":{"key":"pc44800@gmail.com","avatar":"https://avatars.githubusercontent.com/u/17272661?v=4"},"body":"From: Prathamesh <pc44800@gmail.com>\n\nWhenever a git command is present in the upstream of a pipe, its failure\ngets masked by piping and hence it should be avoided for testing the\nupstream git command. By writing out the output of the git command to\na file, we can test the exit codes of both the commands as a failure exit\ncode in any command is able to stop the && chain.\n\nSigned-off-by: Prathamesh <pc44800@gmail.com>\n---\nChanged sendemail.name configuration of the .gitconfig file with a single\nname, and also included the leftover files of each test to be removed by\ntest_when_finished if the test is passed successfully.\n\n t/t2027-worktree-list.sh | 35 +++++++++++++++++++++--------------\n 1 file changed, 21 insertions(+), 14 deletions(-)\n\ndiff --git a/t/t2027-worktree-list.sh b/t/t2027-worktree-list.sh\nindex 848da5f36..720063bf0 100755\n--- a/t/t2027-worktree-list.sh\n+++ b/t/t2027-worktree-list.sh\n@@ -20,7 +20,7 @@ test_expect_success 'rev-parse --git-common-dir on main worktree' '\n \n test_expect_success 'rev-parse --git-path objects linked worktree' '\n \techo \"$(git rev-parse --show-toplevel)/.git/objects\" >expect &&\n-\ttest_when_finished \"rm -rf linked-tree && git worktree prune\" &&\n+\ttest_when_finished \"rm -rf linked-tree actual expect && git worktree prune\" &&\n \tgit worktree add --detach linked-tree master &&\n \tgit -C linked-tree rev-parse --git-path objects >actual &&\n \ttest_cmp expect actual\n@@ -28,19 +28,21 @@ test_expect_success 'rev-parse --git-path objects linked worktree' '\n \n test_expect_success '\"list\" all worktrees from main' '\n \techo \"$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]\" >expect &&\n-\ttest_when_finished \"rm -rf here && git worktree prune\" &&\n+\ttest_when_finished \"rm -rf here out actual expect && git worktree prune\" &&\n \tgit worktree add --detach here master &&\n \techo \"$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n test_expect_success '\"list\" all worktrees from linked' '\n \techo \"$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]\" >expect &&\n-\ttest_when_finished \"rm -rf here && git worktree prune\" &&\n+\ttest_when_finished \"rm -rf here out actual expect && git worktree prune\" &&\n \tgit worktree add --detach here master &&\n \techo \"$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C here worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C here worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -49,7 +51,7 @@ test_expect_success '\"list\" all worktrees --porcelain' '\n \techo \"HEAD $(git rev-parse HEAD)\" >>expect &&\n \techo \"branch $(git symbolic-ref HEAD)\" >>expect &&\n \techo >>expect &&\n-\ttest_when_finished \"rm -rf here && git worktree prune\" &&\n+\ttest_when_finished \"rm -rf here actual expect && git worktree prune\" &&\n \tgit worktree add --detach here master &&\n \techo \"worktree $(git -C here rev-parse --show-toplevel)\" >>expect &&\n \techo \"HEAD $(git rev-parse HEAD)\" >>expect &&\n@@ -69,16 +71,17 @@ test_expect_success 'bare repo setup' '\n '\n \n test_expect_success '\"list\" all worktrees from bare main' '\n-\ttest_when_finished \"rm -rf there && git -C bare1 worktree prune\" &&\n+\ttest_when_finished \"rm -rf there out actual expect && git -C bare1 worktree prune\" &&\n \tgit -C bare1 worktree add --detach ../there master &&\n \techo \"$(pwd)/bare1 (bare)\" >expect &&\n \techo \"$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C bare1 worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C bare1 worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n test_expect_success '\"list\" all worktrees --porcelain from bare main' '\n-\ttest_when_finished \"rm -rf there && git -C bare1 worktree prune\" &&\n+\ttest_when_finished \"rm -rf there actual expect && git -C bare1 worktree prune\" &&\n \tgit -C bare1 worktree add --detach ../there master &&\n \techo \"worktree $(pwd)/bare1\" >expect &&\n \techo \"bare\" >>expect &&\n@@ -92,11 +95,12 @@ test_expect_success '\"list\" all worktrees --porcelain from bare main' '\n '\n \n test_expect_success '\"list\" all worktrees from linked with a bare main' '\n-\ttest_when_finished \"rm -rf there && git -C bare1 worktree prune\" &&\n+\ttest_when_finished \"rm -rf there out actual expect && git -C bare1 worktree prune\" &&\n \tgit -C bare1 worktree add --detach ../there master &&\n \techo \"$(pwd)/bare1 (bare)\" >expect &&\n \techo \"$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C there worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C there worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -118,9 +122,11 @@ test_expect_success 'broken main worktree still at the top' '\n \t\tcd linked &&\n \t\techo \"worktree $(pwd)\" >expected &&\n \t\techo \"ref: .broken\" >../.git/HEAD &&\n-\t\tgit worktree list --porcelain | head -n 3 >actual &&\n+\t\tgit worktree list --porcelain >out &&\n+\t\thead -n 3 out >actual &&\n \t\ttest_cmp ../expected actual &&\n-\t\tgit worktree list | head -n 1 >actual.2 &&\n+\t\tgit worktree list >out &&\n+\t\thead -n 1 out >actual.2 &&\n \t\tgrep -F \"(error)\" actual.2\n \t)\n '\n@@ -134,7 +140,8 @@ test_expect_success 'linked worktrees are sorted' '\n \t\ttest_commit new &&\n \t\tgit worktree add ../first &&\n \t\tgit worktree add ../second &&\n-\t\tgit worktree list --porcelain | grep ^worktree >actual\n+\t\tgit worktree list --porcelain >out &&\n+\t\tgrep ^worktree out >actual\n \t) &&\n \tcat >expected <<-EOF &&\n \tworktree $(pwd)/sorted/main\n-- \n2.11.0\n\n"},{"id":"313877","messageId":"20170313065148.10707-1-pc44800@gmail.com","threadId":"45330","inReplyTo":"58c63e10.5585620a.a224d.11cd@mx.google.com","subject":"[PATCH v3] t2027: avoid using pipes","fromName":"Prathamesh","fromEmail":"pc44800@gmail.com","sentAt":"2017-03-13T06:51:48Z","receivedAt":"2017-03-13T06:52:15Z","isPatch":true,"sender":{"key":"pc44800@gmail.com","avatar":"https://avatars.githubusercontent.com/u/17272661?v=4"},"body":"Whenever a git command is present in the upstream of a pipe, its failure\ngets masked by piping and hence it should be avoided for testing the\nupstream git command. By writing out the output of the git command to\na file, we can test the exit codes of both the commands as a failure exit\ncode in any command is able to stop the && chain.\n\nSigned-off-by: Prathamesh <pc44800@gmail.com>\n---\nChanged sendemail.name configuration of the .gitconfig file with a single\nname, and also included the leftover files of each test to be removed by\ntest_when_finished if the test is passed successfully.\n\n t/t2027-worktree-list.sh | 35 +++++++++++++++++++++--------------\n 1 file changed, 21 insertions(+), 14 deletions(-)\n\ndiff --git a/t/t2027-worktree-list.sh b/t/t2027-worktree-list.sh\nindex 848da5f36..720063bf0 100755\n--- a/t/t2027-worktree-list.sh\n+++ b/t/t2027-worktree-list.sh\n@@ -20,7 +20,7 @@ test_expect_success 'rev-parse --git-common-dir on main worktree' '\n \n test_expect_success 'rev-parse --git-path objects linked worktree' '\n \techo \"$(git rev-parse --show-toplevel)/.git/objects\" >expect &&\n-\ttest_when_finished \"rm -rf linked-tree && git worktree prune\" &&\n+\ttest_when_finished \"rm -rf linked-tree actual expect && git worktree prune\" &&\n \tgit worktree add --detach linked-tree master &&\n \tgit -C linked-tree rev-parse --git-path objects >actual &&\n \ttest_cmp expect actual\n@@ -28,19 +28,21 @@ test_expect_success 'rev-parse --git-path objects linked worktree' '\n \n test_expect_success '\"list\" all worktrees from main' '\n \techo \"$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]\" >expect &&\n-\ttest_when_finished \"rm -rf here && git worktree prune\" &&\n+\ttest_when_finished \"rm -rf here out actual expect && git worktree prune\" &&\n \tgit worktree add --detach here master &&\n \techo \"$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n test_expect_success '\"list\" all worktrees from linked' '\n \techo \"$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]\" >expect &&\n-\ttest_when_finished \"rm -rf here && git worktree prune\" &&\n+\ttest_when_finished \"rm -rf here out actual expect && git worktree prune\" &&\n \tgit worktree add --detach here master &&\n \techo \"$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C here worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C here worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -49,7 +51,7 @@ test_expect_success '\"list\" all worktrees --porcelain' '\n \techo \"HEAD $(git rev-parse HEAD)\" >>expect &&\n \techo \"branch $(git symbolic-ref HEAD)\" >>expect &&\n \techo >>expect &&\n-\ttest_when_finished \"rm -rf here && git worktree prune\" &&\n+\ttest_when_finished \"rm -rf here actual expect && git worktree prune\" &&\n \tgit worktree add --detach here master &&\n \techo \"worktree $(git -C here rev-parse --show-toplevel)\" >>expect &&\n \techo \"HEAD $(git rev-parse HEAD)\" >>expect &&\n@@ -69,16 +71,17 @@ test_expect_success 'bare repo setup' '\n '\n \n test_expect_success '\"list\" all worktrees from bare main' '\n-\ttest_when_finished \"rm -rf there && git -C bare1 worktree prune\" &&\n+\ttest_when_finished \"rm -rf there out actual expect && git -C bare1 worktree prune\" &&\n \tgit -C bare1 worktree add --detach ../there master &&\n \techo \"$(pwd)/bare1 (bare)\" >expect &&\n \techo \"$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C bare1 worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C bare1 worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n test_expect_success '\"list\" all worktrees --porcelain from bare main' '\n-\ttest_when_finished \"rm -rf there && git -C bare1 worktree prune\" &&\n+\ttest_when_finished \"rm -rf there actual expect && git -C bare1 worktree prune\" &&\n \tgit -C bare1 worktree add --detach ../there master &&\n \techo \"worktree $(pwd)/bare1\" >expect &&\n \techo \"bare\" >>expect &&\n@@ -92,11 +95,12 @@ test_expect_success '\"list\" all worktrees --porcelain from bare main' '\n '\n \n test_expect_success '\"list\" all worktrees from linked with a bare main' '\n-\ttest_when_finished \"rm -rf there && git -C bare1 worktree prune\" &&\n+\ttest_when_finished \"rm -rf there out actual expect && git -C bare1 worktree prune\" &&\n \tgit -C bare1 worktree add --detach ../there master &&\n \techo \"$(pwd)/bare1 (bare)\" >expect &&\n \techo \"$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C there worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C there worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -118,9 +122,11 @@ test_expect_success 'broken main worktree still at the top' '\n \t\tcd linked &&\n \t\techo \"worktree $(pwd)\" >expected &&\n \t\techo \"ref: .broken\" >../.git/HEAD &&\n-\t\tgit worktree list --porcelain | head -n 3 >actual &&\n+\t\tgit worktree list --porcelain >out &&\n+\t\thead -n 3 out >actual &&\n \t\ttest_cmp ../expected actual &&\n-\t\tgit worktree list | head -n 1 >actual.2 &&\n+\t\tgit worktree list >out &&\n+\t\thead -n 1 out >actual.2 &&\n \t\tgrep -F \"(error)\" actual.2\n \t)\n '\n@@ -134,7 +140,8 @@ test_expect_success 'linked worktrees are sorted' '\n \t\ttest_commit new &&\n \t\tgit worktree add ../first &&\n \t\tgit worktree add ../second &&\n-\t\tgit worktree list --porcelain | grep ^worktree >actual\n+\t\tgit worktree list --porcelain >out &&\n+\t\tgrep ^worktree out >actual\n \t) &&\n \tcat >expected <<-EOF &&\n \tworktree $(pwd)/sorted/main\n-- \n2.11.0\n\n"},{"id":"314891","messageId":"CAME+mvU-4XE1442zMhRpxKjbGcqPEq8t4rc2qQJvyL4vurrkfg@mail.gmail.com","threadId":"45330","inReplyTo":"20170313065148.10707-1-pc44800@gmail.com","subject":"Re: [PATCH v3] t2027: avoid using pipes","fromName":"Prathamesh","fromEmail":"pc44800@gmail.com","sentAt":"2017-03-22T05:03:13Z","receivedAt":"2017-03-22T05:03:38Z","isPatch":true,"sender":{"key":"pc44800@gmail.com","avatar":"https://avatars.githubusercontent.com/u/17272661?v=4"},"body":"Are there any other changes which I can do to improve my patch?\n\nThanks,\nPrathamesh\n\nOn Mon, Mar 13, 2017 at 12:21 PM, Prathamesh <pc44800@gmail.com> wrote:\n> Whenever a git command is present in the upstream of a pipe, its failure\n> gets masked by piping and hence it should be avoided for testing the\n> upstream git command. By writing out the output of the git command to\n> a file, we can test the exit codes of both the commands as a failure exit\n> code in any command is able to stop the && chain.\n>\n> Signed-off-by: Prathamesh <pc44800@gmail.com>\n> ---\n> Changed sendemail.name configuration of the .gitconfig file with a single\n> name, and also included the leftover files of each test to be removed by\n> test_when_finished if the test is passed successfully.\n>\n>  t/t2027-worktree-list.sh | 35 +++++++++++++++++++++--------------\n>  1 file changed, 21 insertions(+), 14 deletions(-)\n>\n> diff --git a/t/t2027-worktree-list.sh b/t/t2027-worktree-list.sh\n> index 848da5f36..720063bf0 100755\n> --- a/t/t2027-worktree-list.sh\n> +++ b/t/t2027-worktree-list.sh\n> @@ -20,7 +20,7 @@ test_expect_success 'rev-parse --git-common-dir on main worktree' '\n>\n>  test_expect_success 'rev-parse --git-path objects linked worktree' '\n>         echo \"$(git rev-parse --show-toplevel)/.git/objects\" >expect &&\n> -       test_when_finished \"rm -rf linked-tree && git worktree prune\" &&\n> +       test_when_finished \"rm -rf linked-tree actual expect && git worktree prune\" &&\n>         git worktree add --detach linked-tree master &&\n>         git -C linked-tree rev-parse --git-path objects >actual &&\n>         test_cmp expect actual\n> @@ -28,19 +28,21 @@ test_expect_success 'rev-parse --git-path objects linked worktree' '\n>\n>  test_expect_success '\"list\" all worktrees from main' '\n>         echo \"$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]\" >expect &&\n> -       test_when_finished \"rm -rf here && git worktree prune\" &&\n> +       test_when_finished \"rm -rf here out actual expect && git worktree prune\" &&\n>         git worktree add --detach here master &&\n>         echo \"$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n> -       git worktree list | sed \"s/  */ /g\" >actual &&\n> +       git worktree list >out &&\n> +       sed \"s/  */ /g\" <out >actual &&\n>         test_cmp expect actual\n>  '\n>\n>  test_expect_success '\"list\" all worktrees from linked' '\n>         echo \"$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]\" >expect &&\n> -       test_when_finished \"rm -rf here && git worktree prune\" &&\n> +       test_when_finished \"rm -rf here out actual expect && git worktree prune\" &&\n>         git worktree add --detach here master &&\n>         echo \"$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n> -       git -C here worktree list | sed \"s/  */ /g\" >actual &&\n> +       git -C here worktree list >out &&\n> +       sed \"s/  */ /g\" <out >actual &&\n>         test_cmp expect actual\n>  '\n>\n> @@ -49,7 +51,7 @@ test_expect_success '\"list\" all worktrees --porcelain' '\n>         echo \"HEAD $(git rev-parse HEAD)\" >>expect &&\n>         echo \"branch $(git symbolic-ref HEAD)\" >>expect &&\n>         echo >>expect &&\n> -       test_when_finished \"rm -rf here && git worktree prune\" &&\n> +       test_when_finished \"rm -rf here actual expect && git worktree prune\" &&\n>         git worktree add --detach here master &&\n>         echo \"worktree $(git -C here rev-parse --show-toplevel)\" >>expect &&\n>         echo \"HEAD $(git rev-parse HEAD)\" >>expect &&\n> @@ -69,16 +71,17 @@ test_expect_success 'bare repo setup' '\n>  '\n>\n>  test_expect_success '\"list\" all worktrees from bare main' '\n> -       test_when_finished \"rm -rf there && git -C bare1 worktree prune\" &&\n> +       test_when_finished \"rm -rf there out actual expect && git -C bare1 worktree prune\" &&\n>         git -C bare1 worktree add --detach ../there master &&\n>         echo \"$(pwd)/bare1 (bare)\" >expect &&\n>         echo \"$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n> -       git -C bare1 worktree list | sed \"s/  */ /g\" >actual &&\n> +       git -C bare1 worktree list >out &&\n> +       sed \"s/  */ /g\" <out >actual &&\n>         test_cmp expect actual\n>  '\n>\n>  test_expect_success '\"list\" all worktrees --porcelain from bare main' '\n> -       test_when_finished \"rm -rf there && git -C bare1 worktree prune\" &&\n> +       test_when_finished \"rm -rf there actual expect && git -C bare1 worktree prune\" &&\n>         git -C bare1 worktree add --detach ../there master &&\n>         echo \"worktree $(pwd)/bare1\" >expect &&\n>         echo \"bare\" >>expect &&\n> @@ -92,11 +95,12 @@ test_expect_success '\"list\" all worktrees --porcelain from bare main' '\n>  '\n>\n>  test_expect_success '\"list\" all worktrees from linked with a bare main' '\n> -       test_when_finished \"rm -rf there && git -C bare1 worktree prune\" &&\n> +       test_when_finished \"rm -rf there out actual expect && git -C bare1 worktree prune\" &&\n>         git -C bare1 worktree add --detach ../there master &&\n>         echo \"$(pwd)/bare1 (bare)\" >expect &&\n>         echo \"$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n> -       git -C there worktree list | sed \"s/  */ /g\" >actual &&\n> +       git -C there worktree list >out &&\n> +       sed \"s/  */ /g\" <out >actual &&\n>         test_cmp expect actual\n>  '\n>\n> @@ -118,9 +122,11 @@ test_expect_success 'broken main worktree still at the top' '\n>                 cd linked &&\n>                 echo \"worktree $(pwd)\" >expected &&\n>                 echo \"ref: .broken\" >../.git/HEAD &&\n> -               git worktree list --porcelain | head -n 3 >actual &&\n> +               git worktree list --porcelain >out &&\n> +               head -n 3 out >actual &&\n>                 test_cmp ../expected actual &&\n> -               git worktree list | head -n 1 >actual.2 &&\n> +               git worktree list >out &&\n> +               head -n 1 out >actual.2 &&\n>                 grep -F \"(error)\" actual.2\n>         )\n>  '\n> @@ -134,7 +140,8 @@ test_expect_success 'linked worktrees are sorted' '\n>                 test_commit new &&\n>                 git worktree add ../first &&\n>                 git worktree add ../second &&\n> -               git worktree list --porcelain | grep ^worktree >actual\n> +               git worktree list --porcelain >out &&\n> +               grep ^worktree out >actual\n>         ) &&\n>         cat >expected <<-EOF &&\n>         worktree $(pwd)/sorted/main\n> --\n> 2.11.0\n>\n"},{"id":"315044","messageId":"CAP8UFD3xOMbXgH5JATS7-cK_d0YA7Mvkk-ZpLh8sn-KYNm3wxg@mail.gmail.com","threadId":"45330","inReplyTo":"20170313065148.10707-1-pc44800@gmail.com","subject":"Re: [PATCH v3] t2027: avoid using pipes","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2017-03-23T10:15:52Z","receivedAt":"2017-03-23T10:15:59Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Please add something like [GSoC] in the subject so that it is easy for\nus to find GSoC related patches.\n\nOn Mon, Mar 13, 2017 at 7:51 AM, Prathamesh <pc44800@gmail.com> wrote:\n> Whenever a git command is present in the upstream of a pipe, its failure\n> gets masked by piping and hence it should be avoided for testing the\n> upstream git command. By writing out the output of the git command to\n> a file, we can test the exit codes of both the commands as a failure exit\n\nMaybe: s/the commands/commands/\n\n> code in any command is able to stop the && chain.\n\nMaybe: s/is able to/will/\n\n> Signed-off-by: Prathamesh <pc44800@gmail.com>\n> ---\n> Changed sendemail.name configuration of the .gitconfig file with a single\n> name,\n\nAbout that, please note that in Documentation/SubmittingPatches there is:\n\n\"Also notice that a real name is used in the Signed-off-by: line. Please\ndon't hide your real name.\"\n\nSo my opinion on this is that it would be better with your full name\ninstead of just one of your names.\n\n> and also included the leftover files of each test to be removed by\n> test_when_finished if the test is passed successfully.\n\nOk.\n\nYou could also here tell us (again) that it is your GSoC microproject.\nIt would help if we are searching microproject related patches.\n\n>  t/t2027-worktree-list.sh | 35 +++++++++++++++++++++--------------\n>  1 file changed, 21 insertions(+), 14 deletions(-)\n\nOtherwise it looks good to me.\n"},{"id":"315230","messageId":"20170324082736.10301-1-pc44800@gmail.com","threadId":"45330","inReplyTo":"CAP8UFD3xOMbXgH5JATS7-cK_d0YA7Mvkk-ZpLh8sn-KYNm3wxg@mail.gmail.com","subject":"[GSoC][PATCH v4] t2027: avoid using pipes","fromName":"Prathamesh Chavan","fromEmail":"pc44800@gmail.com","sentAt":"2017-03-24T08:27:36Z","receivedAt":"2017-03-24T08:31:16Z","isPatch":true,"sender":{"key":"pc44800@gmail.com","avatar":"https://avatars.githubusercontent.com/u/17272661?v=4"},"body":"From: Prathamesh <pc44800@gmail.com>\n\nWhenever a git command is present in the upstream of a pipe, its failure\ngets masked by piping and hence it should be avoided for testing the\nupstream git command. By writing out the output of the git command to\na file, we can test the exit codes of both commands as a failure exit\ncode in any command will stop the && chain.\n\nSigned-off-by: Prathamesh Chavan <pc44800@gmail.com>\n---\n\nHi, I am Prathamesh Chavan. This is my microproject which I have attempted \nfor Google Summer of Code for 2017.\nAlso in this new version of patch I have changed sendemail.name configuration\nof the .gitconfig file with my full name and changed the description of commit\nmessage as asked.\n\n t/t2027-worktree-list.sh | 35 +++++++++++++++++++++--------------\n 1 file changed, 21 insertions(+), 14 deletions(-)\n\ndiff --git a/t/t2027-worktree-list.sh b/t/t2027-worktree-list.sh\nindex 848da5f36..720063bf0 100755\n--- a/t/t2027-worktree-list.sh\n+++ b/t/t2027-worktree-list.sh\n@@ -20,7 +20,7 @@ test_expect_success 'rev-parse --git-common-dir on main worktree' '\n \n test_expect_success 'rev-parse --git-path objects linked worktree' '\n \techo \"$(git rev-parse --show-toplevel)/.git/objects\" >expect &&\n-\ttest_when_finished \"rm -rf linked-tree && git worktree prune\" &&\n+\ttest_when_finished \"rm -rf linked-tree actual expect && git worktree prune\" &&\n \tgit worktree add --detach linked-tree master &&\n \tgit -C linked-tree rev-parse --git-path objects >actual &&\n \ttest_cmp expect actual\n@@ -28,19 +28,21 @@ test_expect_success 'rev-parse --git-path objects linked worktree' '\n \n test_expect_success '\"list\" all worktrees from main' '\n \techo \"$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]\" >expect &&\n-\ttest_when_finished \"rm -rf here && git worktree prune\" &&\n+\ttest_when_finished \"rm -rf here out actual expect && git worktree prune\" &&\n \tgit worktree add --detach here master &&\n \techo \"$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n test_expect_success '\"list\" all worktrees from linked' '\n \techo \"$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]\" >expect &&\n-\ttest_when_finished \"rm -rf here && git worktree prune\" &&\n+\ttest_when_finished \"rm -rf here out actual expect && git worktree prune\" &&\n \tgit worktree add --detach here master &&\n \techo \"$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C here worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C here worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -49,7 +51,7 @@ test_expect_success '\"list\" all worktrees --porcelain' '\n \techo \"HEAD $(git rev-parse HEAD)\" >>expect &&\n \techo \"branch $(git symbolic-ref HEAD)\" >>expect &&\n \techo >>expect &&\n-\ttest_when_finished \"rm -rf here && git worktree prune\" &&\n+\ttest_when_finished \"rm -rf here actual expect && git worktree prune\" &&\n \tgit worktree add --detach here master &&\n \techo \"worktree $(git -C here rev-parse --show-toplevel)\" >>expect &&\n \techo \"HEAD $(git rev-parse HEAD)\" >>expect &&\n@@ -69,16 +71,17 @@ test_expect_success 'bare repo setup' '\n '\n \n test_expect_success '\"list\" all worktrees from bare main' '\n-\ttest_when_finished \"rm -rf there && git -C bare1 worktree prune\" &&\n+\ttest_when_finished \"rm -rf there out actual expect && git -C bare1 worktree prune\" &&\n \tgit -C bare1 worktree add --detach ../there master &&\n \techo \"$(pwd)/bare1 (bare)\" >expect &&\n \techo \"$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C bare1 worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C bare1 worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n test_expect_success '\"list\" all worktrees --porcelain from bare main' '\n-\ttest_when_finished \"rm -rf there && git -C bare1 worktree prune\" &&\n+\ttest_when_finished \"rm -rf there actual expect && git -C bare1 worktree prune\" &&\n \tgit -C bare1 worktree add --detach ../there master &&\n \techo \"worktree $(pwd)/bare1\" >expect &&\n \techo \"bare\" >>expect &&\n@@ -92,11 +95,12 @@ test_expect_success '\"list\" all worktrees --porcelain from bare main' '\n '\n \n test_expect_success '\"list\" all worktrees from linked with a bare main' '\n-\ttest_when_finished \"rm -rf there && git -C bare1 worktree prune\" &&\n+\ttest_when_finished \"rm -rf there out actual expect && git -C bare1 worktree prune\" &&\n \tgit -C bare1 worktree add --detach ../there master &&\n \techo \"$(pwd)/bare1 (bare)\" >expect &&\n \techo \"$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C there worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C there worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -118,9 +122,11 @@ test_expect_success 'broken main worktree still at the top' '\n \t\tcd linked &&\n \t\techo \"worktree $(pwd)\" >expected &&\n \t\techo \"ref: .broken\" >../.git/HEAD &&\n-\t\tgit worktree list --porcelain | head -n 3 >actual &&\n+\t\tgit worktree list --porcelain >out &&\n+\t\thead -n 3 out >actual &&\n \t\ttest_cmp ../expected actual &&\n-\t\tgit worktree list | head -n 1 >actual.2 &&\n+\t\tgit worktree list >out &&\n+\t\thead -n 1 out >actual.2 &&\n \t\tgrep -F \"(error)\" actual.2\n \t)\n '\n@@ -134,7 +140,8 @@ test_expect_success 'linked worktrees are sorted' '\n \t\ttest_commit new &&\n \t\tgit worktree add ../first &&\n \t\tgit worktree add ../second &&\n-\t\tgit worktree list --porcelain | grep ^worktree >actual\n+\t\tgit worktree list --porcelain >out &&\n+\t\tgrep ^worktree out >actual\n \t) &&\n \tcat >expected <<-EOF &&\n \tworktree $(pwd)/sorted/main\n-- \n2.11.0\n\n"},{"id":"315238","messageId":"908bb2a8-033e-6cf6-e996-9f779d128fd5@web.de","threadId":"45330","inReplyTo":"20170324082736.10301-1-pc44800@gmail.com","subject":"Re: [GSoC][PATCH v4] t2027: avoid using pipes","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2017-03-24T11:58:11Z","receivedAt":"2017-03-24T11:58:07Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"\nOn 24/03/17 09:27, Prathamesh Chavan wrote:\n> From: Prathamesh <pc44800@gmail.com>\nWelcome to Git.\nThe name in the \"From:\" must match the name in the sign-off:\ngit config --global user.name \"Prathamesh Chavan\"\n\n> Signed-off-by: Prathamesh Chavan <pc44800@gmail.com>\n\nThe patch looks good otherwise.\n"},{"id":"315239","messageId":"20170324120433.2890-1-pc44800@gmail.com","threadId":"45330","inReplyTo":"CAP8UFD3xOMbXgH5JATS7-cK_d0YA7Mvkk-ZpLh8sn-KYNm3wxg@mail.gmail.com","subject":"[GSoC][PATCH v4] t2027: avoid using pipes","fromName":"Prathamesh Chavan","fromEmail":"pc44800@gmail.com","sentAt":"2017-03-24T12:04:33Z","receivedAt":"2017-03-24T12:05:35Z","isPatch":true,"sender":{"key":"pc44800@gmail.com","avatar":"https://avatars.githubusercontent.com/u/17272661?v=4"},"body":"Whenever a git command is present in the upstream of a pipe, its failure\ngets masked by piping and hence it should be avoided for testing the\nupstream git command. By writing out the output of the git command to\na file, we can test the exit codes of both the commands as a failure exit\ncode in any command is able to stop the && chain.\n\nSigned-off-by: Prathamesh Chavan <pc44800@gmail.com>\n---\n\nHi, I am Prathamesh Chavan. This is my microproject which I have attempted \nfor Google Summer of Code for 2017.\nAlso in this new version of patch I have changed sendemail.name configuration\nof the .gitconfig file with my full name and changed the description of\ncommit message as asked.\n\n t/t2027-worktree-list.sh | 35 +++++++++++++++++++++--------------\n 1 file changed, 21 insertions(+), 14 deletions(-)\n\ndiff --git a/t/t2027-worktree-list.sh b/t/t2027-worktree-list.sh\nindex 848da5f36..720063bf0 100755\n--- a/t/t2027-worktree-list.sh\n+++ b/t/t2027-worktree-list.sh\n@@ -20,7 +20,7 @@ test_expect_success 'rev-parse --git-common-dir on main worktree' '\n \n test_expect_success 'rev-parse --git-path objects linked worktree' '\n \techo \"$(git rev-parse --show-toplevel)/.git/objects\" >expect &&\n-\ttest_when_finished \"rm -rf linked-tree && git worktree prune\" &&\n+\ttest_when_finished \"rm -rf linked-tree actual expect && git worktree prune\" &&\n \tgit worktree add --detach linked-tree master &&\n \tgit -C linked-tree rev-parse --git-path objects >actual &&\n \ttest_cmp expect actual\n@@ -28,19 +28,21 @@ test_expect_success 'rev-parse --git-path objects linked worktree' '\n \n test_expect_success '\"list\" all worktrees from main' '\n \techo \"$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]\" >expect &&\n-\ttest_when_finished \"rm -rf here && git worktree prune\" &&\n+\ttest_when_finished \"rm -rf here out actual expect && git worktree prune\" &&\n \tgit worktree add --detach here master &&\n \techo \"$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n test_expect_success '\"list\" all worktrees from linked' '\n \techo \"$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]\" >expect &&\n-\ttest_when_finished \"rm -rf here && git worktree prune\" &&\n+\ttest_when_finished \"rm -rf here out actual expect && git worktree prune\" &&\n \tgit worktree add --detach here master &&\n \techo \"$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C here worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C here worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -49,7 +51,7 @@ test_expect_success '\"list\" all worktrees --porcelain' '\n \techo \"HEAD $(git rev-parse HEAD)\" >>expect &&\n \techo \"branch $(git symbolic-ref HEAD)\" >>expect &&\n \techo >>expect &&\n-\ttest_when_finished \"rm -rf here && git worktree prune\" &&\n+\ttest_when_finished \"rm -rf here actual expect && git worktree prune\" &&\n \tgit worktree add --detach here master &&\n \techo \"worktree $(git -C here rev-parse --show-toplevel)\" >>expect &&\n \techo \"HEAD $(git rev-parse HEAD)\" >>expect &&\n@@ -69,16 +71,17 @@ test_expect_success 'bare repo setup' '\n '\n \n test_expect_success '\"list\" all worktrees from bare main' '\n-\ttest_when_finished \"rm -rf there && git -C bare1 worktree prune\" &&\n+\ttest_when_finished \"rm -rf there out actual expect && git -C bare1 worktree prune\" &&\n \tgit -C bare1 worktree add --detach ../there master &&\n \techo \"$(pwd)/bare1 (bare)\" >expect &&\n \techo \"$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C bare1 worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C bare1 worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n test_expect_success '\"list\" all worktrees --porcelain from bare main' '\n-\ttest_when_finished \"rm -rf there && git -C bare1 worktree prune\" &&\n+\ttest_when_finished \"rm -rf there actual expect && git -C bare1 worktree prune\" &&\n \tgit -C bare1 worktree add --detach ../there master &&\n \techo \"worktree $(pwd)/bare1\" >expect &&\n \techo \"bare\" >>expect &&\n@@ -92,11 +95,12 @@ test_expect_success '\"list\" all worktrees --porcelain from bare main' '\n '\n \n test_expect_success '\"list\" all worktrees from linked with a bare main' '\n-\ttest_when_finished \"rm -rf there && git -C bare1 worktree prune\" &&\n+\ttest_when_finished \"rm -rf there out actual expect && git -C bare1 worktree prune\" &&\n \tgit -C bare1 worktree add --detach ../there master &&\n \techo \"$(pwd)/bare1 (bare)\" >expect &&\n \techo \"$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C there worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C there worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -118,9 +122,11 @@ test_expect_success 'broken main worktree still at the top' '\n \t\tcd linked &&\n \t\techo \"worktree $(pwd)\" >expected &&\n \t\techo \"ref: .broken\" >../.git/HEAD &&\n-\t\tgit worktree list --porcelain | head -n 3 >actual &&\n+\t\tgit worktree list --porcelain >out &&\n+\t\thead -n 3 out >actual &&\n \t\ttest_cmp ../expected actual &&\n-\t\tgit worktree list | head -n 1 >actual.2 &&\n+\t\tgit worktree list >out &&\n+\t\thead -n 1 out >actual.2 &&\n \t\tgrep -F \"(error)\" actual.2\n \t)\n '\n@@ -134,7 +140,8 @@ test_expect_success 'linked worktrees are sorted' '\n \t\ttest_commit new &&\n \t\tgit worktree add ../first &&\n \t\tgit worktree add ../second &&\n-\t\tgit worktree list --porcelain | grep ^worktree >actual\n+\t\tgit worktree list --porcelain >out &&\n+\t\tgrep ^worktree out >actual\n \t) &&\n \tcat >expected <<-EOF &&\n \tworktree $(pwd)/sorted/main\n-- \n2.11.0\n\n"},{"id":"316109","messageId":"CAGZ79kbmriQoJgjF0-Kv1QzU2NWn=2EGN10CbNTKYO4zCBMFaA@mail.gmail.com","threadId":"45330","inReplyTo":"20170324120433.2890-1-pc44800@gmail.com","subject":"Re: [GSoC][PATCH v4] t2027: avoid using pipes","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-04-03T19:40:20Z","receivedAt":"2017-04-03T19:40:26Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Fri, Mar 24, 2017 at 5:04 AM, Prathamesh Chavan <pc44800@gmail.com> wrote:\n> Whenever a git command is present in the upstream of a pipe, its failure\n> gets masked by piping and hence it should be avoided for testing the\n> upstream git command. By writing out the output of the git command to\n> a file, we can test the exit codes of both the commands as a failure exit\n> code in any command is able to stop the && chain.\n\nSorry for dropping the ball here.\nThis patch is identical in code that Torsten reviewed and has a\nslight grammar fix in the commit message.\n\n> Signed-off-by: Prathamesh Chavan <pc44800@gmail.com>\n\nI reviewed the patch it it looks fine.\n\nThanks,\nStefan\n"},{"id":"316113","messageId":"20170403213557.27724-1-pc44800@gmail.com","threadId":"45330","inReplyTo":"CAGZ79kbmriQoJgjF0-Kv1QzU2NWn=2EGN10CbNTKYO4zCBMFaA@mail.gmail.com","subject":"[GSoC][PATCH v5] t2027: avoid using pipes","fromName":"Prathamesh Chavan","fromEmail":"pc44800@gmail.com","sentAt":"2017-04-03T21:35:57Z","receivedAt":"2017-04-03T21:36:38Z","isPatch":true,"sender":{"key":"pc44800@gmail.com","avatar":"https://avatars.githubusercontent.com/u/17272661?v=4"},"body":"Whenever a git command is present in the upstream of a pipe, its failure\ngets masked by piping. Hence we should avoid it for testing the\nupstream git command. By writing out the output of the git command to\na file, we can test the exit codes of both the commands as a failure exit\ncode in any command is able to stop the && chain.\n\nSigned-off-by: Prathamesh Chavan <pc44800@gmail.com>\n---\n\nIn this new version of the patch, I resolved the grammar mistakes\nfrom the commit message. Thanks for pointing it out.\n\n t/t2027-worktree-list.sh | 35 +++++++++++++++++++++--------------\n 1 file changed, 21 insertions(+), 14 deletions(-)\n\ndiff --git a/t/t2027-worktree-list.sh b/t/t2027-worktree-list.sh\nindex 848da5f36..720063bf0 100755\n--- a/t/t2027-worktree-list.sh\n+++ b/t/t2027-worktree-list.sh\n@@ -20,7 +20,7 @@ test_expect_success 'rev-parse --git-common-dir on main worktree' '\n \n test_expect_success 'rev-parse --git-path objects linked worktree' '\n \techo \"$(git rev-parse --show-toplevel)/.git/objects\" >expect &&\n-\ttest_when_finished \"rm -rf linked-tree && git worktree prune\" &&\n+\ttest_when_finished \"rm -rf linked-tree actual expect && git worktree prune\" &&\n \tgit worktree add --detach linked-tree master &&\n \tgit -C linked-tree rev-parse --git-path objects >actual &&\n \ttest_cmp expect actual\n@@ -28,19 +28,21 @@ test_expect_success 'rev-parse --git-path objects linked worktree' '\n \n test_expect_success '\"list\" all worktrees from main' '\n \techo \"$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]\" >expect &&\n-\ttest_when_finished \"rm -rf here && git worktree prune\" &&\n+\ttest_when_finished \"rm -rf here out actual expect && git worktree prune\" &&\n \tgit worktree add --detach here master &&\n \techo \"$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n test_expect_success '\"list\" all worktrees from linked' '\n \techo \"$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]\" >expect &&\n-\ttest_when_finished \"rm -rf here && git worktree prune\" &&\n+\ttest_when_finished \"rm -rf here out actual expect && git worktree prune\" &&\n \tgit worktree add --detach here master &&\n \techo \"$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C here worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C here worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -49,7 +51,7 @@ test_expect_success '\"list\" all worktrees --porcelain' '\n \techo \"HEAD $(git rev-parse HEAD)\" >>expect &&\n \techo \"branch $(git symbolic-ref HEAD)\" >>expect &&\n \techo >>expect &&\n-\ttest_when_finished \"rm -rf here && git worktree prune\" &&\n+\ttest_when_finished \"rm -rf here actual expect && git worktree prune\" &&\n \tgit worktree add --detach here master &&\n \techo \"worktree $(git -C here rev-parse --show-toplevel)\" >>expect &&\n \techo \"HEAD $(git rev-parse HEAD)\" >>expect &&\n@@ -69,16 +71,17 @@ test_expect_success 'bare repo setup' '\n '\n \n test_expect_success '\"list\" all worktrees from bare main' '\n-\ttest_when_finished \"rm -rf there && git -C bare1 worktree prune\" &&\n+\ttest_when_finished \"rm -rf there out actual expect && git -C bare1 worktree prune\" &&\n \tgit -C bare1 worktree add --detach ../there master &&\n \techo \"$(pwd)/bare1 (bare)\" >expect &&\n \techo \"$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C bare1 worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C bare1 worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n test_expect_success '\"list\" all worktrees --porcelain from bare main' '\n-\ttest_when_finished \"rm -rf there && git -C bare1 worktree prune\" &&\n+\ttest_when_finished \"rm -rf there actual expect && git -C bare1 worktree prune\" &&\n \tgit -C bare1 worktree add --detach ../there master &&\n \techo \"worktree $(pwd)/bare1\" >expect &&\n \techo \"bare\" >>expect &&\n@@ -92,11 +95,12 @@ test_expect_success '\"list\" all worktrees --porcelain from bare main' '\n '\n \n test_expect_success '\"list\" all worktrees from linked with a bare main' '\n-\ttest_when_finished \"rm -rf there && git -C bare1 worktree prune\" &&\n+\ttest_when_finished \"rm -rf there out actual expect && git -C bare1 worktree prune\" &&\n \tgit -C bare1 worktree add --detach ../there master &&\n \techo \"$(pwd)/bare1 (bare)\" >expect &&\n \techo \"$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)\" >>expect &&\n-\tgit -C there worktree list | sed \"s/  */ /g\" >actual &&\n+\tgit -C there worktree list >out &&\n+\tsed \"s/  */ /g\" <out >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -118,9 +122,11 @@ test_expect_success 'broken main worktree still at the top' '\n \t\tcd linked &&\n \t\techo \"worktree $(pwd)\" >expected &&\n \t\techo \"ref: .broken\" >../.git/HEAD &&\n-\t\tgit worktree list --porcelain | head -n 3 >actual &&\n+\t\tgit worktree list --porcelain >out &&\n+\t\thead -n 3 out >actual &&\n \t\ttest_cmp ../expected actual &&\n-\t\tgit worktree list | head -n 1 >actual.2 &&\n+\t\tgit worktree list >out &&\n+\t\thead -n 1 out >actual.2 &&\n \t\tgrep -F \"(error)\" actual.2\n \t)\n '\n@@ -134,7 +140,8 @@ test_expect_success 'linked worktrees are sorted' '\n \t\ttest_commit new &&\n \t\tgit worktree add ../first &&\n \t\tgit worktree add ../second &&\n-\t\tgit worktree list --porcelain | grep ^worktree >actual\n+\t\tgit worktree list --porcelain >out &&\n+\t\tgrep ^worktree out >actual\n \t) &&\n \tcat >expected <<-EOF &&\n \tworktree $(pwd)/sorted/main\n-- \n2.11.0\n\n"}]}