Browse Source

t0003: do not chdir the whole test process

Moving to some other directory and letting the remainder of the test
pieces to expect that they start there is a bad practice.  The test
that contains chdir itself may fail (or by mistake skipped via the
GIT_SKIP_TESTS mechanism) in which case the remainder may operate on
files in unexpected places.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Junio C Hamano 11 years ago
parent
commit
c4a7bce1b5
  1. 12
      t/t0003-attributes.sh

12
t/t0003-attributes.sh

@ -197,11 +197,12 @@ test_expect_success 'root subdir attribute test' '
' '


test_expect_success 'setup bare' ' test_expect_success 'setup bare' '
git clone --bare . bare.git && git clone --bare . bare.git
cd bare.git
' '


test_expect_success 'bare repository: check that .gitattribute is ignored' ' test_expect_success 'bare repository: check that .gitattribute is ignored' '
(
cd bare.git &&
( (
echo "f test=f" echo "f test=f"
echo "a/i test=a/i" echo "a/i test=a/i"
@ -211,16 +212,22 @@ test_expect_success 'bare repository: check that .gitattribute is ignored' '
attr_check a/c/f unspecified && attr_check a/c/f unspecified &&
attr_check a/i unspecified && attr_check a/i unspecified &&
attr_check subdir/a/i unspecified attr_check subdir/a/i unspecified
)
' '


test_expect_success 'bare repository: check that --cached honors index' ' test_expect_success 'bare repository: check that --cached honors index' '
(
cd bare.git &&
GIT_INDEX_FILE=../.git/index \ GIT_INDEX_FILE=../.git/index \
git check-attr --cached --stdin --all <../stdin-all | git check-attr --cached --stdin --all <../stdin-all |
sort >actual && sort >actual &&
test_cmp ../specified-all actual test_cmp ../specified-all actual
)
' '


test_expect_success 'bare repository: test info/attributes' ' test_expect_success 'bare repository: test info/attributes' '
(
cd bare.git &&
( (
echo "f test=f" echo "f test=f"
echo "a/i test=a/i" echo "a/i test=a/i"
@ -230,6 +237,7 @@ test_expect_success 'bare repository: test info/attributes' '
attr_check a/c/f f && attr_check a/c/f f &&
attr_check a/i a/i && attr_check a/i a/i &&
attr_check subdir/a/i unspecified attr_check subdir/a/i unspecified
)
' '


test_done test_done

Loading…
Cancel
Save