@matheusbsbs / matheus-bagliano / commits / 13e65fe631
Fork 0

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>

Junio C Hamano committed Feb 24, 2010 at 10:22 UTC 13e65fe6314bf44e64f22b9b66a4e5940adaa2e5
1 file changed +20 -26
t/t5521-pull-options.sh
+20 -26
@@ -4,8 +4,6 @@ test_description='pull options'
4
5 . ./test-lib.sh
6
7 -D=`pwd`
8 -
7 test_expect_success 'setup' '
8 mkdir parent &&
9 (cd parent && git init &&
@@ -13,48 +11,44 @@ test_expect_success 'setup' '
11 git commit -m one)
12 '
13
16 -cd "$D"
17 -
14 test_expect_success 'git pull -q' '
15 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)
20 '
21
25 -cd "$D"
26 -
22 test_expect_success 'git pull' '
23 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)
28 '
33 -cd "$D"
29
30 test_expect_success 'git pull -v' '
31 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)
36 '
37
42 -cd "$D"
43 -
38 test_expect_success 'git pull -v -q' '
39 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)
44 '
45
51 -cd "$D"
52 -
46 test_expect_success 'git pull -q -v' '
47 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)
52 '
53
54 test_done