Message ID | 20230328173932.3614601-3-felipe.contreras@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | test: make the test suite work with zsh | expand |
On Tue, Mar 28 2023, Felipe Contreras wrote:
> It has special meaning in zsh.
Nit: If we are going to rename these I'd prefer (just from grepping
existing examples) $exit_code, $code, $ret etc. a "$stat" at a glance
would seem to refer to stat() somehow, which is confusing.
On Tue, Mar 28, 2023 at 11:39:28AM -0600, Felipe Contreras wrote: > --- > 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(-) Maybe I'm misreading your patch or its subject line, but all of these hunks convert from something (usually "status") _to_ "stat". Is the point to avoid "status", not "stat"? Or the other way around? Thanks, Taylor
On Fri, Mar 31, 2023 at 6:05 PM Taylor Blau <me@ttaylorr.com> wrote: > > On Tue, Mar 28, 2023 at 11:39:28AM -0600, Felipe Contreras wrote: > > --- > > 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(-) > > Maybe I'm misreading your patch or its subject line, but all of these > hunks convert from something (usually "status") _to_ "stat". No, the title is wrong; the purpose is to avoid `status`, which in zsh it's linked to $?
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}
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(-)