diff mbox series

[v3,3/8] diff tests: fix ignored exit codes in t4023

Message ID patch-v3-3.8-4ec075689f6-20221202T114733Z-avarab@gmail.com (mailing list archive)
State Superseded
Headers show
Series tests: fix ignored & hidden exit codes | expand

Commit Message

Ævar Arnfjörð Bjarmason Dec. 2, 2022, 11:52 a.m. UTC
Change a "git diff-tree" command to be &&-chained so that we won't
ignore its exit code, see the ea05fd5fbf7 (Merge branch
'ab/keep-git-exit-codes-in-tests', 2022-03-16) topic for prior art.

This fixes code added in b45563a229f (rename: Break filepairs with
different types., 2007-11-30). Due to hiding the exit code we hid a
memory leak under SANITIZE=leak.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t4023-diff-rename-typechange.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Junio C Hamano Dec. 5, 2022, 12:26 a.m. UTC | #1
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:

> Change a "git diff-tree" command to be &&-chained so that we won't
> ignore its exit code, see the ea05fd5fbf7 (Merge branch
> 'ab/keep-git-exit-codes-in-tests', 2022-03-16) topic for prior art.
>
> This fixes code added in b45563a229f (rename: Break filepairs with
> different types., 2007-11-30). Due to hiding the exit code we hid a
> memory leak under SANITIZE=leak.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>  t/t4023-diff-rename-typechange.sh | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

I already have this as 1ebeb849 (diff tests: fix ignored exit codes
in t4023, 2022-12-02) on ab/t4023-avoid-losing-exit-status-of-diff
topic.

Thanks.


>
> diff --git a/t/t4023-diff-rename-typechange.sh b/t/t4023-diff-rename-typechange.sh
> index 7cb99092938..25c31b0cb1b 100755
> --- a/t/t4023-diff-rename-typechange.sh
> +++ b/t/t4023-diff-rename-typechange.sh
> @@ -52,8 +52,8 @@ test_expect_success setup '
>  '
>  
>  test_expect_success 'cross renames to be detected for regular files' '
> -
> -	git diff-tree five six -r --name-status -B -M | sort >actual &&
> +	git diff-tree five six -r --name-status -B -M >out &&
> +	sort <out >actual &&
>  	{
>  		echo "R100	foo	bar" &&
>  		echo "R100	bar	foo"
> @@ -63,8 +63,8 @@ test_expect_success 'cross renames to be detected for regular files' '
>  '
>  
>  test_expect_success 'cross renames to be detected for typechange' '
> -
> -	git diff-tree one two -r --name-status -B -M | sort >actual &&
> +	git diff-tree one two -r --name-status -B -M >out &&
> +	sort <out >actual &&
>  	{
>  		echo "R100	foo	bar" &&
>  		echo "R100	bar	foo"
> @@ -74,8 +74,8 @@ test_expect_success 'cross renames to be detected for typechange' '
>  '
>  
>  test_expect_success 'moves and renames' '
> -
> -	git diff-tree three four -r --name-status -B -M | sort >actual &&
> +	git diff-tree three four -r --name-status -B -M >out &&
> +	sort <out >actual &&
>  	{
>  		# see -B -M (#6) in t4008
>  		echo "C100	foo	bar" &&
diff mbox series

Patch

diff --git a/t/t4023-diff-rename-typechange.sh b/t/t4023-diff-rename-typechange.sh
index 7cb99092938..25c31b0cb1b 100755
--- a/t/t4023-diff-rename-typechange.sh
+++ b/t/t4023-diff-rename-typechange.sh
@@ -52,8 +52,8 @@  test_expect_success setup '
 '
 
 test_expect_success 'cross renames to be detected for regular files' '
-
-	git diff-tree five six -r --name-status -B -M | sort >actual &&
+	git diff-tree five six -r --name-status -B -M >out &&
+	sort <out >actual &&
 	{
 		echo "R100	foo	bar" &&
 		echo "R100	bar	foo"
@@ -63,8 +63,8 @@  test_expect_success 'cross renames to be detected for regular files' '
 '
 
 test_expect_success 'cross renames to be detected for typechange' '
-
-	git diff-tree one two -r --name-status -B -M | sort >actual &&
+	git diff-tree one two -r --name-status -B -M >out &&
+	sort <out >actual &&
 	{
 		echo "R100	foo	bar" &&
 		echo "R100	bar	foo"
@@ -74,8 +74,8 @@  test_expect_success 'cross renames to be detected for typechange' '
 '
 
 test_expect_success 'moves and renames' '
-
-	git diff-tree three four -r --name-status -B -M | sort >actual &&
+	git diff-tree three four -r --name-status -B -M >out &&
+	sort <out >actual &&
 	{
 		# see -B -M (#6) in t4008
 		echo "C100	foo	bar" &&