Re: [PATCH 5/8] diff-highlight: use test_decode_color in tests
- From
Jeff King <peff@peff.net>
- Date
- Mar 22, 2026, 20:47 UTC
- Message-ID
- <20260322204750.GB2047044@coredump.intra.peff.net>
- In-Reply-To
- <b992e118-f948-4145-8d77-96f00b497f99@gmail.com>
On Mon, Mar 23, 2026 at 01:24:00AM +0800, Tian Yuchen wrote:
Show 8 quoted lines
> > @@ -42,9 +39,9 @@ dh_test () {
> > } >/dev/null &&
> > "$DIFF_HIGHLIGHT" <diff.raw >diff.hi &&
> > - test_strip_patch_header <diff.hi >diff.act
> > + test_strip_patch_header <diff.hi | test_decode_color >diff.act
>
> Although this is just simple text filtering and leaving it as is wouldn’t
> cause any problems IMO, why not go ahead and add the && while you’re at it?The bug is in an earlier commit (patch 3), which breaks apart the pipe but doesn't add the necessary &&. And it's more than just text filtering; it breaks the &&-chain, so we miss the exit code of $DIFF_HIGHLIGHT (which was the whole point of patch 3).
chainlint doesn't find it because we're in a helper function, not directinly in a test snippet.
I'll send a revised series to fix it, but...
> I've noticed that there are several missing &&.
Where else do you see?
Or do you mean that we should not pipe text filtering commands? There I'd disagree. We are not likely to see a failure from 'sed', and if we do, the fact that the output does not match would catch it. And the cost of breaking every command down without pipes means having to manage lots of intermediate files.
-Peff