diff mbox series

[2/6] t6040 test: stop using global "script" variable

Message ID 20190619233046.27503-3-avarab@gmail.com (mailing list archive)
State New, archived
Headers show
Series Change <non-empty?> GIT_TEST_* variables to <boolean> | expand

Commit Message

Ævar Arnfjörð Bjarmason June 19, 2019, 11:30 p.m. UTC
Change test code added in c0234b2ef6 ("stat_tracking_info(): clear
object flags used during counting", 2008-07-03) to stop using the
"script" variable also used for lazy prerequisites in
test-lib-functions.sh.

Since this test uses test_i18ncmp and expects to use its own "script"
variable twice it implicitly depends on the C_LOCALE_OUTPUT
prerequisite not being a lazy prerequisite. A follow-up change will
make it a lazy prerequisite, so we must remove this landmine before
inadvertently stepping on it as we make that change.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t6040-tracking-info.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Junio C Hamano June 20, 2019, 7:54 p.m. UTC | #1
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:

> Change test code added in c0234b2ef6 ("stat_tracking_info(): clear
> object flags used during counting", 2008-07-03) to stop using the
> "script" variable also used for lazy prerequisites in
> test-lib-functions.sh.
>
> Since this test uses test_i18ncmp and expects to use its own "script"
> variable twice it implicitly depends on the C_LOCALE_OUTPUT
> prerequisite not being a lazy prerequisite. A follow-up change will
> make it a lazy prerequisite, so we must remove this landmine before
> inadvertently stepping on it as we make that change.

Well spotted (eh, I suspect that you didn't until you actually stomped
on the landmine and saw it trigger, and then pretending to have had
the perfect foresight in this series, which is perfectly fine ;-),
and nicely done.

>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>  t/t6040-tracking-info.sh | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh
> index 716283b274..970b25a289 100755
> --- a/t/t6040-tracking-info.sh
> +++ b/t/t6040-tracking-info.sh
> @@ -38,7 +38,7 @@ test_expect_success setup '
>  	advance h
>  '
>  
> -script='s/^..\(b.\) *[0-9a-f]* \(.*\)$/\1 \2/p'
> +t6040_script='s/^..\(b.\) *[0-9a-f]* \(.*\)$/\1 \2/p'
>  cat >expect <<\EOF
>  b1 [ahead 1, behind 1] d
>  b2 [ahead 1, behind 1] d
> @@ -53,7 +53,7 @@ test_expect_success 'branch -v' '
>  		cd test &&
>  		git branch -v
>  	) |
> -	sed -n -e "$script" >actual &&
> +	sed -n -e "$t6040_script" >actual &&
>  	test_i18ncmp expect actual
>  '
>  
> @@ -71,7 +71,7 @@ test_expect_success 'branch -vv' '
>  		cd test &&
>  		git branch -vv
>  	) |
> -	sed -n -e "$script" >actual &&
> +	sed -n -e "$t6040_script" >actual &&
>  	test_i18ncmp expect actual
>  '
diff mbox series

Patch

diff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh
index 716283b274..970b25a289 100755
--- a/t/t6040-tracking-info.sh
+++ b/t/t6040-tracking-info.sh
@@ -38,7 +38,7 @@  test_expect_success setup '
 	advance h
 '
 
-script='s/^..\(b.\) *[0-9a-f]* \(.*\)$/\1 \2/p'
+t6040_script='s/^..\(b.\) *[0-9a-f]* \(.*\)$/\1 \2/p'
 cat >expect <<\EOF
 b1 [ahead 1, behind 1] d
 b2 [ahead 1, behind 1] d
@@ -53,7 +53,7 @@  test_expect_success 'branch -v' '
 		cd test &&
 		git branch -v
 	) |
-	sed -n -e "$script" >actual &&
+	sed -n -e "$t6040_script" >actual &&
 	test_i18ncmp expect actual
 '
 
@@ -71,7 +71,7 @@  test_expect_success 'branch -vv' '
 		cd test &&
 		git branch -vv
 	) |
-	sed -n -e "$script" >actual &&
+	sed -n -e "$t6040_script" >actual &&
 	test_i18ncmp expect actual
 '