Re: [PATCH v2 16/22] t/t3*: merge a "grep | awk" pipeline
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Mar 16, 2024, 01:49 UTC
- Message-ID
- <ZfT6xxBnQs6ppYB2@nand.local>
- In-Reply-To
- <20240315194620.10713-17-dev+git@drbeat.li>
On Fri, Mar 15, 2024 at 08:46:13PM +0100, Beat Bolli wrote:
Show 15 quoted lines
> Signed-off-by: Beat Bolli <dev+git@drbeat.li>
> ---
> t/t3920-crlf-messages.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/t3920-crlf-messages.sh b/t/t3920-crlf-messages.sh
> index 5eed640a6825..50ae222f0842 100755
> --- a/t/t3920-crlf-messages.sh
> +++ b/t/t3920-crlf-messages.sh
> @@ -97,7 +97,7 @@ test_expect_success 'branch: --verbose works with messages using CRLF' '
> git branch -v >tmp &&
> # Remove first two columns, and the line for the currently checked out branch
> current=$(git branch --show-current) &&
> - grep -v $current <tmp | awk "{\$1=\$2=\"\"}1" >actual &&
> + awk "/$current/ { next } { \$1 = \$2 = \"\" } 1" <tmp >actual &&I think that using `next` here is fine to ignore lines that match `$current`, but the canonical approach would probably be using the `!` operator instead to negate the match, like so:
awk "!/$current/ { \$1 = \$2 = \"\" } 1" <tmp >actual &&Not worth a reroll, of course, just something that I noticed while reading.
Thanks, Taylor