Skip to content

Commit 13e65fe

Browse files
committed
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>
1 parent e923eae commit 13e65fe

1 file changed

Lines changed: 20 additions & 26 deletions

File tree

t/t5521-pull-options.sh

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,57 +4,51 @@ test_description='pull options'
44

55
. ./test-lib.sh
66

7-
D=`pwd`
8-
97
test_expect_success 'setup' '
108
mkdir parent &&
119
(cd parent && git init &&
1210
echo one >file && git add file &&
1311
git commit -m one)
1412
'
1513

16-
cd "$D"
17-
1814
test_expect_success 'git pull -q' '
1915
mkdir clonedq &&
20-
cd clonedq &&
21-
git pull -q "$D/parent" >out 2>err &&
22-
test ! -s out
16+
(cd clonedq && git init &&
17+
git pull -q "../parent" >out 2>err &&
18+
test ! -s err &&
19+
test ! -s out)
2320
'
2421

25-
cd "$D"
26-
2722
test_expect_success 'git pull' '
2823
mkdir cloned &&
29-
cd cloned &&
30-
git pull "$D/parent" >out 2>err &&
31-
test -s out
24+
(cd cloned && git init &&
25+
git pull "../parent" >out 2>err &&
26+
test -s err &&
27+
test ! -s out)
3228
'
33-
cd "$D"
3429

3530
test_expect_success 'git pull -v' '
3631
mkdir clonedv &&
37-
cd clonedv &&
38-
git pull -v "$D/parent" >out 2>err &&
39-
test -s out
32+
(cd clonedv && git init &&
33+
git pull -v "../parent" >out 2>err &&
34+
test -s err &&
35+
test ! -s out)
4036
'
4137

42-
cd "$D"
43-
4438
test_expect_success 'git pull -v -q' '
4539
mkdir clonedvq &&
46-
cd clonedvq &&
47-
git pull -v -q "$D/parent" >out 2>err &&
48-
test ! -s out
40+
(cd clonedvq && git init &&
41+
git pull -v -q "../parent" >out 2>err &&
42+
test ! -s out &&
43+
test ! -s err)
4944
'
5045

51-
cd "$D"
52-
5346
test_expect_success 'git pull -q -v' '
5447
mkdir clonedqv &&
55-
cd clonedqv &&
56-
git pull -q -v "$D/parent" >out 2>err &&
57-
test -s out
48+
(cd clonedqv && git init &&
49+
git pull -q -v "../parent" >out 2>err &&
50+
test ! -s out &&
51+
test -s err)
5852
'
5953

6054
test_done

0 commit comments

Comments
 (0)