t5521: fix and modernize

All of these tests were bogus, as they created new directory and tried to
run "git pull" without even running "git init" in there.  They were mucking
with the repository in $TEST_DIRECTORY.

While fixing it, modernize the style not to chdir around outside of
subshell.  Otherwise a failed test will take us to an unexpected directory
and we need to chdir back to the test directory in each test, which is
ugly and error prone.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano 2010-02-24 10:22:05 -08:00
parent e923eaeb90
commit 13e65fe631

View File

@ -4,8 +4,6 @@ test_description='pull options'
. ./test-lib.sh . ./test-lib.sh
D=`pwd`
test_expect_success 'setup' ' test_expect_success 'setup' '
mkdir parent && mkdir parent &&
(cd parent && git init && (cd parent && git init &&
@ -13,48 +11,44 @@ test_expect_success 'setup' '
git commit -m one) git commit -m one)
' '
cd "$D"
test_expect_success 'git pull -q' ' test_expect_success 'git pull -q' '
mkdir clonedq && mkdir clonedq &&
cd clonedq && (cd clonedq && git init &&
git pull -q "$D/parent" >out 2>err && git pull -q "../parent" >out 2>err &&
test ! -s out test ! -s err &&
test ! -s out)
' '
cd "$D"
test_expect_success 'git pull' ' test_expect_success 'git pull' '
mkdir cloned && mkdir cloned &&
cd cloned && (cd cloned && git init &&
git pull "$D/parent" >out 2>err && git pull "../parent" >out 2>err &&
test -s out test -s err &&
test ! -s out)
' '
cd "$D"
test_expect_success 'git pull -v' ' test_expect_success 'git pull -v' '
mkdir clonedv && mkdir clonedv &&
cd clonedv && (cd clonedv && git init &&
git pull -v "$D/parent" >out 2>err && git pull -v "../parent" >out 2>err &&
test -s out test -s err &&
test ! -s out)
' '
cd "$D"
test_expect_success 'git pull -v -q' ' test_expect_success 'git pull -v -q' '
mkdir clonedvq && mkdir clonedvq &&
cd clonedvq && (cd clonedvq && git init &&
git pull -v -q "$D/parent" >out 2>err && git pull -v -q "../parent" >out 2>err &&
test ! -s out test ! -s out &&
test ! -s err)
' '
cd "$D"
test_expect_success 'git pull -q -v' ' test_expect_success 'git pull -q -v' '
mkdir clonedqv && mkdir clonedqv &&
cd clonedqv && (cd clonedqv && git init &&
git pull -q -v "$D/parent" >out 2>err && git pull -q -v "../parent" >out 2>err &&
test -s out test ! -s out &&
test -s err)
' '
test_done test_done