From: Amanda Shafack <shafack.likhene@gmail.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Amanda Shafack via GitGitGadget <gitgitgadget@gmail.com>,
Git List <git@vger.kernel.org>,
Emily Shaffer <emilyshaffer@google.com>,
Jonathan Nieder <jrnieder@gmail.com>
Subject: Re: [PATCH 2/2] t2200: modify code syntax
Date: Sun, 18 Oct 2020 14:59:12 +0100 [thread overview]
Message-ID: <CAGxm6oXhW8x2jkN-P4emhp6BvAwk6urzFTauQBDhJdMV_0d1fg@mail.gmail.com> (raw)
In-Reply-To: <CAPig+cRuutHJ64aXQy5X9h-Vg4=_NKKyL57KdwbvXj4cGRS1PQ@mail.gmail.com>
I agree with you. I have made these changes as well.
Thanks
On Sun, Oct 18, 2020 at 6:56 AM Eric Sunshine <sunshine@sunshineco.com> wrote:
>
> On Sat, Oct 17, 2020 at 12:02 PM Amanda Shafack via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
> > Using the logical not operator on both the git and grep command is
> > redundant, since the main check is done at the level of the grep
> > command.
> >
> > Apply the logical not operator only to the grep command.
> > ---
> > diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh
> > @@ -179,10 +179,8 @@ test_expect_success 'add -u resolves unmerged paths' '
> > - ! (
> > - git ls-files >actual &&
> > - grep "non-existent" actual
> > - )
> > + git ls-files >actual &&
> > + ! grep "non-existent" actual
>
> The commit message talks only about redundancy of applying the logical
> NOT operator to the combined subshell content, but what it misses is
> that transformation of:
>
> ! (git ls-files | grep "non-existent")
>
> in patch [1/2] into:
>
> ! (
> git ls-files >actual &&
> grep "non-existent" actual
> )
>
> is actively wrong. In particular, if `git ls-files` itself fails, then
> the `grep` will never get run, and the subshell will exit with a
> failure, however, the NOT then turns that failure into a success,
> which is quite undesirable. The test should fail if either `git
> ls-files` fails or if the `grep` expectation is not met; it should not
> succeed when `git ls-files` fails.
>
> So, the correct thing to do is to merge [1/2] and [2/2] into a single
> patch which directly transforms:
>
> ! (git ls-files | grep "non-existent")
>
> into:
>
> git ls-files >actual &&
> ! grep "non-existent" actual
--
Cheers!
Amanda Shafack
next prev parent reply other threads:[~2020-10-18 13:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-17 16:02 [PATCH 0/2] [Outreachy][Patch v1] t9832,t2200: avoid using pipes in git related commands Amanda Shafack via GitGitGadget
2020-10-17 16:02 ` [PATCH 1/2] t9832,t2200: avoid using pipes in git commands Amanda Shafack via GitGitGadget
2020-10-18 6:11 ` Eric Sunshine
2020-10-18 13:57 ` Amanda Shafack
2020-10-17 16:02 ` [PATCH 2/2] t2200: modify code syntax Amanda Shafack via GitGitGadget
2020-10-18 5:55 ` Eric Sunshine
2020-10-18 13:59 ` Amanda Shafack [this message]
2020-10-18 14:42 ` [PATCH v2] t9832,t2200: avoid using pipes in git commands Amanda Shafack via GitGitGadget
2020-10-18 19:25 ` Eric Sunshine
2020-10-18 20:04 ` Junio C Hamano
2020-10-18 22:04 ` Amanda Shafack
2020-10-18 20:40 ` Amanda Shafack
2020-10-18 20:48 ` [PATCH v3] t2200,t9832: avoid using 'git' upstream in a pipe Amanda Shafack via GitGitGadget
2020-10-18 21:01 ` Junio C Hamano
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=CAGxm6oXhW8x2jkN-P4emhp6BvAwk6urzFTauQBDhJdMV_0d1fg@mail.gmail.com \
--to=shafack.likhene@gmail.com \
--cc=emilyshaffer@google.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=jrnieder@gmail.com \
--cc=sunshine@sunshineco.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 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 NNTP newsgroup(s).