Re: [Outreachy][PATCH v3] t6050: avoid pipes with downstream Git commands
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Oct 11, 2024, 16:03 UTC
- Message-ID
- <CAPig+cRLdzAEA-G=L81yR9dmm8Y-5VEU7ybyohKmbq9=0bDUaQ@mail.gmail.com>
- In-Reply-To
- <20241011154555.584917-1-chizobajames21@gmail.com>
On Fri, Oct 11, 2024 at 11:46 AM <chizobajames21@gmail.com> wrote:
Show 16 quoted lines
> In pipes, the exit code of a chain of commands is determined by > the final command. In order not to miss the exit code of a failed > Git command, avoid pipes instead write output of Git commands > into a file. > For better debugging experience, instances of "grep" were changed > to "test_grep". "test_grep" provides more context in case of a > failed "grep". > > Signed-off-by: Chizoba ODINAKA <chizobajames21@gmail.com> > --- > diff --git a/t/t6050-replace.sh b/t/t6050-replace.sh > @@ -344,7 +374,8 @@ test_expect_success 'test --format medium' ' > - git replace -l --format medium | sort >actual && > + git replace -l --format medium >actual && > + sort actual && > test_cmp expected actual
Isn't this conversion broken? The `sort` command emits the sorted content to its standard output stream; it does not sort the file in place. So this is doing the sort but then simply throwing the output away, not capturing it to a file for comparison via `test_cmp`.