diff mbox series

[v7,1/8] t7600: clean up 'merge --squash c3 with c7' test

Message ID 6716d28a5187c44c1d90f5ce840c44441f62352c.1552275703.git.liu.denton@gmail.com (mailing list archive)
State New, archived
Headers show
Series Fix scissors bug during conflict | expand

Commit Message

Denton Liu March 11, 2019, 3:42 a.m. UTC
This cleans up the original test by removing some unnecessary braces and
removing a pipe.

Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
---
 t/t7600-merge.sh | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Junio C Hamano March 12, 2019, 1:03 a.m. UTC | #1
Denton Liu <liu.denton@gmail.com> writes:

> -	{
> -		cat <<-EOF
> +	cat >expect <<-EOF &&
>  		Squashed commit of the following:
>  
>  		$(git show -s c7)
> @@ -242,8 +241,8 @@ test_expect_success 'merge --squash c3 with c7' '
>  		# Conflicts:
>  		#	file
>  		EOF
> -	} >expect &&

As you are dedenting the "cat <<-EOF", the body and closing EOF
should also be dedented one level, i.e.

	cat >expect <<-EOF &&
	Squashed commit of the following:
	...
	# Conflicts:
	#	file
	EOF

> -	git cat-file commit HEAD | sed -e '1,/^$/d' >actual &&
> +	git cat-file commit HEAD >tmp &&
> +	sed -e '1,/^$/d' <tmp >actual &&

The intermediary file may want a name better than 'tmp', if it is to
be left behind, but this will do for now.

>  	test_cmp expect actual
>  '

Thanks for the clean-up.
diff mbox series

Patch

diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 106148254d..d879efd330 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -233,8 +233,7 @@  test_expect_success 'merge --squash c3 with c7' '
 	cat result.9z >file &&
 	git commit --no-edit -a &&
 
-	{
-		cat <<-EOF
+	cat >expect <<-EOF &&
 		Squashed commit of the following:
 
 		$(git show -s c7)
@@ -242,8 +241,8 @@  test_expect_success 'merge --squash c3 with c7' '
 		# Conflicts:
 		#	file
 		EOF
-	} >expect &&
-	git cat-file commit HEAD | sed -e '1,/^$/d' >actual &&
+	git cat-file commit HEAD >tmp &&
+	sed -e '1,/^$/d' <tmp >actual &&
 	test_cmp expect actual
 '