Skip to content

Commit

Permalink
t0000: check whether the shell supports the "local" keyword
Browse files Browse the repository at this point in the history
Add a test balloon to see if we get complaints from anybody who is
using a shell that doesn't support the "local" keyword. If so, this
test can be reverted. If not, we might want to consider using "local"
in shell code throughout the git code base.

Signed-off-by: Michael Haggerty <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
mhagger authored and gitster committed Oct 31, 2017
1 parent cb5918a commit 01d3a52
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions t/t0000-basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,31 @@ modification *should* take notice and update the test vectors here.

. ./test-lib.sh

try_local_x () {
local x="local" &&
echo "$x"
}

# This test is an experiment to check whether any Git users are using
# Shells that don't support the "local" keyword. "local" is not
# POSIX-standard, but it is very widely supported by POSIX-compliant
# shells, and if it doesn't cause problems for people, we would like
# to be able to use it in Git code.
#
# For now, this is the only test that requires "local". If your shell
# fails this test, you can ignore the failure, but please report the
# problem to the Git mailing list <[email protected]>, as it might
# convince us to continue avoiding the use of "local".
test_expect_success 'verify that the running shell supports "local"' '
x="notlocal" &&
echo "local" >expected1 &&
try_local_x >actual1 &&
test_cmp expected1 actual1 &&
echo "notlocal" >expected2 &&
echo "$x" >actual2 &&
test_cmp expected2 actual2
'

################################################################
# git init has been done in an empty repository.
# make sure it is empty.
Expand Down

0 comments on commit 01d3a52

Please sign in to comment.