git manpage: note git-security@googlegroups.com
[gitweb.git] / t / t0000-basic.sh
index 8345c8a72a46bc781c503de21c832261c1d2b256..7fd87dd5444040ad7273be51c29a56dea738a861 100755 (executable)
@@ -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 <git@vger.kernel.org>, 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.
@@ -98,7 +123,7 @@ check_sub_test_lib_test () {
 }
 
 check_sub_test_lib_test_err () {
-       name="$1" # stdin is the expected output output from the test
+       name="$1" # stdin is the expected output from the test
        # expected error output is in descriptior 3
        (
                cd "$name" &&
@@ -253,7 +278,7 @@ test_expect_success 'test --verbose' '
        test_expect_success "failing test" false
        test_done
        EOF
-       mv test-verbose/out test-verbose/out+
+       mv test-verbose/out test-verbose/out+ &&
        grep -v "^Initialized empty" test-verbose/out+ >test-verbose/out &&
        check_sub_test_lib_test test-verbose <<-\EOF
        > expecting success: true
@@ -296,66 +321,72 @@ test_expect_success 'test --verbose-only' '
 '
 
 test_expect_success 'GIT_SKIP_TESTS' "
-       GIT_SKIP_TESTS='git.2' \
+       (
+               GIT_SKIP_TESTS='git.2' && export GIT_SKIP_TESTS &&
                run_sub_test_lib_test git-skip-tests-basic \
-               'GIT_SKIP_TESTS' <<-\\EOF &&
-       for i in 1 2 3
-       do
-               test_expect_success \"passing test #\$i\" 'true'
-       done
-       test_done
-       EOF
-       check_sub_test_lib_test git-skip-tests-basic <<-\\EOF
-       > ok 1 - passing test #1
-       > ok 2 # skip passing test #2 (GIT_SKIP_TESTS)
-       > ok 3 - passing test #3
-       > # passed all 3 test(s)
-       > 1..3
-       EOF
+                       'GIT_SKIP_TESTS' <<-\\EOF &&
+               for i in 1 2 3
+               do
+                       test_expect_success \"passing test #\$i\" 'true'
+               done
+               test_done
+               EOF
+               check_sub_test_lib_test git-skip-tests-basic <<-\\EOF
+               > ok 1 - passing test #1
+               > ok 2 # skip passing test #2 (GIT_SKIP_TESTS)
+               > ok 3 - passing test #3
+               > # passed all 3 test(s)
+               > 1..3
+               EOF
+       )
 "
 
 test_expect_success 'GIT_SKIP_TESTS several tests' "
-       GIT_SKIP_TESTS='git.2 git.5' \
+       (
+               GIT_SKIP_TESTS='git.2 git.5' && export GIT_SKIP_TESTS &&
                run_sub_test_lib_test git-skip-tests-several \
-               'GIT_SKIP_TESTS several tests' <<-\\EOF &&
-       for i in 1 2 3 4 5 6
-       do
-               test_expect_success \"passing test #\$i\" 'true'
-       done
-       test_done
-       EOF
-       check_sub_test_lib_test git-skip-tests-several <<-\\EOF
-       > ok 1 - passing test #1
-       > ok 2 # skip passing test #2 (GIT_SKIP_TESTS)
-       > ok 3 - passing test #3
-       > ok 4 - passing test #4
-       > ok 5 # skip passing test #5 (GIT_SKIP_TESTS)
-       > ok 6 - passing test #6
-       > # passed all 6 test(s)
-       > 1..6
-       EOF
+                       'GIT_SKIP_TESTS several tests' <<-\\EOF &&
+               for i in 1 2 3 4 5 6
+               do
+                       test_expect_success \"passing test #\$i\" 'true'
+               done
+               test_done
+               EOF
+               check_sub_test_lib_test git-skip-tests-several <<-\\EOF
+               > ok 1 - passing test #1
+               > ok 2 # skip passing test #2 (GIT_SKIP_TESTS)
+               > ok 3 - passing test #3
+               > ok 4 - passing test #4
+               > ok 5 # skip passing test #5 (GIT_SKIP_TESTS)
+               > ok 6 - passing test #6
+               > # passed all 6 test(s)
+               > 1..6
+               EOF
+       )
 "
 
 test_expect_success 'GIT_SKIP_TESTS sh pattern' "
-       GIT_SKIP_TESTS='git.[2-5]' \
+       (
+               GIT_SKIP_TESTS='git.[2-5]' && export GIT_SKIP_TESTS &&
                run_sub_test_lib_test git-skip-tests-sh-pattern \
-               'GIT_SKIP_TESTS sh pattern' <<-\\EOF &&
-       for i in 1 2 3 4 5 6
-       do
-               test_expect_success \"passing test #\$i\" 'true'
-       done
-       test_done
-       EOF
-       check_sub_test_lib_test git-skip-tests-sh-pattern <<-\\EOF
-       > ok 1 - passing test #1
-       > ok 2 # skip passing test #2 (GIT_SKIP_TESTS)
-       > ok 3 # skip passing test #3 (GIT_SKIP_TESTS)
-       > ok 4 # skip passing test #4 (GIT_SKIP_TESTS)
-       > ok 5 # skip passing test #5 (GIT_SKIP_TESTS)
-       > ok 6 - passing test #6
-       > # passed all 6 test(s)
-       > 1..6
-       EOF
+                       'GIT_SKIP_TESTS sh pattern' <<-\\EOF &&
+               for i in 1 2 3 4 5 6
+               do
+                       test_expect_success \"passing test #\$i\" 'true'
+               done
+               test_done
+               EOF
+               check_sub_test_lib_test git-skip-tests-sh-pattern <<-\\EOF
+               > ok 1 - passing test #1
+               > ok 2 # skip passing test #2 (GIT_SKIP_TESTS)
+               > ok 3 # skip passing test #3 (GIT_SKIP_TESTS)
+               > ok 4 # skip passing test #4 (GIT_SKIP_TESTS)
+               > ok 5 # skip passing test #5 (GIT_SKIP_TESTS)
+               > ok 6 - passing test #6
+               > # passed all 6 test(s)
+               > 1..6
+               EOF
+       )
 "
 
 test_expect_success '--run basic' "
@@ -828,7 +859,7 @@ test_expect_success 'git write-tree should be able to write an empty tree' '
 '
 
 test_expect_success 'validate object ID of a known tree' '
-       test "$tree" = 4b825dc642cb6eb9a060e54bf8d69288fbee4904
+       test "$tree" = $EMPTY_TREE
 '
 
 # Various types of objects
@@ -968,7 +999,7 @@ test_expect_success 'writing this tree with --missing-ok' '
 
 ################################################################
 test_expect_success 'git read-tree followed by write-tree should be idempotent' '
-       rm -f .git/index
+       rm -f .git/index &&
        git read-tree $tree &&
        test -f .git/index &&
        newtree=$(git write-tree) &&