git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/6] test: avoid `stat` variable

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Mar 28, 2023, 17:39 UTC
Message-ID
<20230328173932.3614601-3-felipe.contreras@gmail.com>
In-Reply-To
<20230328173932.3614601-1-felipe.contreras@gmail.com>
It has special meaning in zsh.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 t/t0001-init.sh                | 4 ++--
 t/t3432-rebase-fast-forward.sh | 4 ++--
 t/t4013-diff-various.sh        | 6 +++---
 t/t5512-ls-remote.sh           | 4 ++--
 t/t5516-fetch-push.sh          | 8 ++++----
 t/test-lib.sh                  | 4 ++--
 6 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 30a6edca1d..88c9de8f53 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -362,12 +362,12 @@ test_lazy_prereq GETCWD_IGNORES_PERMS '
 		cd $base/dir &&
 		test-tool getcwd
 	)
-	status=$?
+	stat=$?
 
 	chmod 700 $base &&
 	rm -rf $base ||
 	BUG "cannot clean $base"
-	return $status
+	return $stat
 '
 
 check_long_base_path () {
diff --git a/t/t3432-rebase-fast-forward.sh b/t/t3432-rebase-fast-forward.sh
index 7f1a5dd3de..49ecf8f18b 100755
--- a/t/t3432-rebase-fast-forward.sh
+++ b/t/t3432-rebase-fast-forward.sh
@@ -41,7 +41,7 @@ test_rebase_same_head () {
 }
 
 test_rebase_same_head_ () {
-	status="$1" &&
+	stat="$1" &&
 	shift &&
 	what="$1" &&
 	shift &&
@@ -57,7 +57,7 @@ test_rebase_same_head_ () {
 	else
 		msg="git rebase$flag $* with $changes is $what with $cmp HEAD"
 	fi &&
-	test_expect_$status "$msg" "
+	test_expect_$stat "$msg" "
 		if test $abbreviate -eq 1
 		then
 			test_config rebase.abbreviateCommands true
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index 5de1d19075..8f82946c2f 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -178,7 +178,7 @@ process_diffs () {
 V=$(git version | sed -e 's/^git version //' -e 's/\./\\./g')
 while read magic cmd
 do
-	status=success
+	stat=success
 	case "$magic" in
 	'' | '#'*)
 		continue ;;
@@ -188,7 +188,7 @@ do
 		case "$magic" in
 		noellipses) ;;
 		failure)
-			status=failure
+			stat=failure
 			magic=
 			label="$cmd" ;;
 		*)
@@ -203,7 +203,7 @@ do
 	expect="$TEST_DIRECTORY/t4013/diff.$test"
 	actual="$pfx-diff.$test"
 
-	test_expect_$status "git $cmd # magic is ${magic:-(not used)}" '
+	test_expect_$stat "git $cmd # magic is ${magic:-(not used)}" '
 		{
 			echo "$ git $cmd"
 			case "$magic" in
diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh
index 20d063fb9a..88f0f81baf 100755
--- a/t/t5512-ls-remote.sh
+++ b/t/t5512-ls-remote.sh
@@ -167,9 +167,9 @@ test_expect_success 'confuses pattern as remote when no remote specified' '
 test_expect_success 'die with non-2 for wrong repository even with --exit-code' '
 	{
 		git ls-remote --exit-code ./no-such-repository
-		status=$?
+		stat=$?
 	} &&
-	test $status != 2 && test $status != 0
+	test $stat != 2 && test $stat != 0
 '
 
 test_expect_success 'Report success even when nothing matches' '
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 19ebefa5ac..ed8b676156 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -1732,9 +1732,9 @@ test_expect_success 'updateInstead with push-to-checkout hook' '
 
 	git update-index -q --refresh &&
 	git read-tree -u -m HEAD "$1" || {
-		status=$?
+		stat=$?
 		echo >&2 read-tree failed
-		exit $status
+		exit $stat
 	}
 	EOF
 
@@ -1800,9 +1800,9 @@ test_expect_success 'updateInstead with push-to-checkout hook' '
 	no)
 		git read-tree -u -m "$1" ;;
 	esac || {
-		status=$?
+		stat=$?
 		echo >&2 read-tree failed
-		exit $status
+		exit $stat
 	}
 	EOF
 
diff --git a/t/test-lib.sh b/t/test-lib.sh
index cc705df981..621a10941d 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1866,12 +1866,12 @@ test_lazy_prereq SANITY '
 
 	! test -r SANETESTD.1/x &&
 	! rm SANETESTD.1/x && ! test -f SANETESTD.2/x
-	status=$?
+	stat=$?
 
 	chmod +rwx SANETESTD.1 SANETESTD.2 &&
 	rm -rf SANETESTD.1 SANETESTD.2 ||
 	BUG "cannot clean SANETESTD"
-	return $status
+	return $stat
 '
 
 test FreeBSD != $uname_s || GIT_UNZIP=${GIT_UNZIP:-/usr/local/bin/unzip}
-- 
2.39.2.13.g1fb56cf030
Previous: Felipe ContrerasNext: Ævar Arnfjörð Bjarmason
Message 7 of 29 in “test: make the test suite work with zsh”
  1. 0/6 test: make the test suite work with zshFelipe Contreras, Mar 28, 2023
  2. 3/6 test: avoid `options` variableFelipe Contreras, Mar 28, 2023
  3. 1/6 test: fix build for zshFelipe Contreras, Mar 28, 2023
  4. 5/6 test: hack for zshFelipe Contreras, Mar 28, 2023
  5. Felipe ContrerasMar 30, 2023
  6. 6/6 mergetools: vimdiff: check for empty fieldsFelipe Contreras, Mar 28, 2023
  7. 2/6 test: avoid `stat` variableFelipe Contreras, Mar 28, 2023
  8. Ævar Arnfjörð BjarmasonMar 29, 2023
  9. Taylor BlauApr 1, 2023
  10. Felipe ContrerasApr 1, 2023
  11. 4/6 test: avoid `path` variableFelipe Contreras, Mar 28, 2023
  12. brian m. carlsonMar 29, 2023
  13. Felipe ContrerasMar 29, 2023
  14. Ævar Arnfjörð BjarmasonMar 29, 2023
  15. Felipe ContrerasMar 29, 2023
  16. Felipe ContrerasMar 30, 2023
  17. Junio C HamanoMar 29, 2023
  18. Felipe ContrerasMar 29, 2023
  19. Junio C HamanoMar 30, 2023
  20. Felipe ContrerasMar 30, 2023
  21. Taylor BlauApr 1, 2023
  22. Felipe ContrerasApr 1, 2023
  23. Junio C HamanoApr 1, 2023
  24. Felipe ContrerasApr 1, 2023
  25. Taylor BlauApr 1, 2023
  26. Felipe ContrerasApr 1, 2023
  27. brian m. carlsonMar 29, 2023
  28. Junio C HamanoMar 30, 2023
  29. Felipe ContrerasMar 30, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.