[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    Re: [PATCH V2 1/2] patch-id: Fix antipatterns in tests
From:       Junio C Hamano <gitster () pobox ! com>
Date:       2022-01-31 23:36:43
Message-ID: xmqqfsp3h3zo.fsf () gitster ! g
[Download RAW message or body]

Jerry Zhang <jerry@skydio.com> writes:

>  test_expect_success 'patch-id handles no-nl-at-eof markers' '
> -	cat nonl | calc_patch_id nonl &&
> -	cat withnl | calc_patch_id withnl &&
> +	cat >nonl <<-EOF &&

Unless you use $variable_expanded_to_its_value in the here-doc,
always make it a habit to quote the EOF marker.  That helps the
readers by assuring that there is no funny interpolation going on.

> +	diff --git i/a w/a
> +	index e69de29..2e65efe 100644
> +	--- i/a
> +	+++ w/a
> +	@@ -0,0 +1 @@
> +	+a
> +	\ No newline at end of file
> +	diff --git i/b w/b
> +	index e69de29..6178079 100644
> +	--- i/b
> +	+++ w/b
> +	@@ -0,0 +1 @@
> +	+b
> +	EOF
> +	cat >withnl <<-EOF &&

Likewise.

> +	diff --git i/a w/a
> +	index e69de29..7898192 100644
> +	--- i/a
> +	+++ w/a
> +	@@ -0,0 +1 @@
> +	+a
> +	diff --git i/b w/b
> +	index e69de29..6178079 100644
> +	--- i/b
> +	+++ w/b
> +	@@ -0,0 +1 @@
> +	+b
> +	EOF
> +	calc_patch_id nonl <nonl &&
> +	calc_patch_id withnl <withnl &&
>  	test_cmp patch-id_nonl patch-id_withnl
>  '
>  test_done
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic