Re: [PATCH v3 0/2] [Outreachy][Patch v2] t3404: avoid losing exit status to pipes
- From
Usman Akinyemi <usmanakinyemi202@gmail.com>
- Date
- Oct 7, 2024, 09:01 UTC
- Message-ID
- <CAPSxiM9=CzKzjjQCmqeyt5mNf4jFMTwNzN7pzPhAgbLsM8Um+g@mail.gmail.com>
- In-Reply-To
- <CAPig+cTGESaCMfCzP7Zt3Y6JmG_uroCn1cd6_12W1QKLU7hk8A@mail.gmail.com>
On Mon, Oct 7, 2024 at 8:11 AM Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 18 quoted lines
> > On Mon, Oct 7, 2024 at 4:08 AM Patrick Steinhardt <ps@pks.im> wrote: > > On Mon, Oct 07, 2024 at 07:25:44AM +0000, Usman Akinyemi wrote: > > > test $base = $(git rev-parse HEAD^) && > > > git show >output && > > > grep NEVER output >actual && > > > test_must_be_empty actual && > > > > That makes sense. The expectation here is that `output` shouldn't > > contain the string "NEVER" at all. And as grep(1) would fail when it > > doesn't find a match the whole test would fail like this. So the below > > would likely be the best solution. > > Thanks. I was just about to respond with the same answer. As a bit of > extra explanation, the &&-chaining means that every command in the > chain must return "success" (status 0), but the return code of `grep` > depends upon whether or not it matched any lines. In this case, it > returned non-zero which caused the test to fail.
Thanks Eric and Partrick. Thanks for the explanation. I will update the patch then.