Skip to content

Commit

Permalink
t5521: fix and modernize
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Feb 24, 2010
1 parent e923eae commit 13e65fe
Showing 1 changed file with 20 additions and 26 deletions.
46 changes: 20 additions & 26 deletions t/t5521-pull-options.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,51 @@ test_description='pull options'

. ./test-lib.sh

D=`pwd`

test_expect_success 'setup' '
mkdir parent &&
(cd parent && git init &&
echo one >file && git add file &&
git commit -m one)
'

cd "$D"

test_expect_success 'git pull -q' '
mkdir clonedq &&
cd clonedq &&
git pull -q "$D/parent" >out 2>err &&
test ! -s out
(cd clonedq && git init &&
git pull -q "../parent" >out 2>err &&
test ! -s err &&
test ! -s out)
'

cd "$D"

test_expect_success 'git pull' '
mkdir cloned &&
cd cloned &&
git pull "$D/parent" >out 2>err &&
test -s out
(cd cloned && git init &&
git pull "../parent" >out 2>err &&
test -s err &&
test ! -s out)
'
cd "$D"

test_expect_success 'git pull -v' '
mkdir clonedv &&
cd clonedv &&
git pull -v "$D/parent" >out 2>err &&
test -s out
(cd clonedv && git init &&
git pull -v "../parent" >out 2>err &&
test -s err &&
test ! -s out)
'

cd "$D"

test_expect_success 'git pull -v -q' '
mkdir clonedvq &&
cd clonedvq &&
git pull -v -q "$D/parent" >out 2>err &&
test ! -s out
(cd clonedvq && git init &&
git pull -v -q "../parent" >out 2>err &&
test ! -s out &&
test ! -s err)
'

cd "$D"

test_expect_success 'git pull -q -v' '
mkdir clonedqv &&
cd clonedqv &&
git pull -q -v "$D/parent" >out 2>err &&
test -s out
(cd clonedqv && git init &&
git pull -q -v "../parent" >out 2>err &&
test ! -s out &&
test -s err)
'

test_done

0 comments on commit 13e65fe

Please sign in to comment.