6
6
test_description=' test transitive info/alternate entries'
7
7
. ./test-lib.sh
8
8
9
- base_dir=$( pwd)
10
-
11
9
test_expect_success ' preparing first repository' '
12
- test_create_repo A &&
13
- cd A &&
14
- echo "Hello World" > file1 &&
15
- git add file1 &&
16
- git commit -m "Initial commit" file1 &&
17
- git repack -a -d &&
18
- git prune
10
+ test_create_repo A && (
11
+ cd A &&
12
+ echo "Hello World" > file1 &&
13
+ git add file1 &&
14
+ git commit -m "Initial commit" file1 &&
15
+ git repack -a -d &&
16
+ git prune
17
+ )
19
18
'
20
19
21
- cd " $base_dir "
22
-
23
20
test_expect_success ' preparing second repository' '
24
- git clone -l -s A B &&
25
- cd B &&
26
- echo "foo bar" > file2 &&
27
- git add file2 &&
28
- git commit -m "next commit" file2 &&
29
- git repack -a -d -l &&
30
- git prune
21
+ git clone -l -s A B && (
22
+ cd B &&
23
+ echo "foo bar" > file2 &&
24
+ git add file2 &&
25
+ git commit -m "next commit" file2 &&
26
+ git repack -a -d -l &&
27
+ git prune
28
+ )
31
29
'
32
30
33
- cd " $base_dir "
34
-
35
31
test_expect_success ' preparing third repository' '
36
- git clone -l -s B C &&
37
- cd C &&
38
- echo "Goodbye, cruel world" > file3 &&
39
- git add file3 &&
40
- git commit -m "one more" file3 &&
41
- git repack -a -d -l &&
42
- git prune
32
+ git clone -l -s B C && (
33
+ cd C &&
34
+ echo "Goodbye, cruel world" > file3 &&
35
+ git add file3 &&
36
+ git commit -m "one more" file3 &&
37
+ git repack -a -d -l &&
38
+ git prune
39
+ )
43
40
'
44
41
45
- cd " $base_dir "
46
-
47
42
test_expect_success ' creating too deep nesting' '
48
43
git clone -l -s C D &&
49
44
git clone -l -s D E &&
@@ -53,55 +48,34 @@ test_expect_success 'creating too deep nesting' '
53
48
'
54
49
55
50
test_expect_success ' invalidity of deepest repository' '
56
- cd H &&
57
- test_must_fail git fsck
51
+ test_must_fail git -C H fsck
58
52
'
59
53
60
- cd " $base_dir "
61
-
62
54
test_expect_success ' validity of third repository' '
63
- cd C &&
64
- git fsck
55
+ git -C C fsck
65
56
'
66
57
67
- cd " $base_dir "
68
-
69
58
test_expect_success ' validity of fourth repository' '
70
- cd D &&
71
- git fsck
59
+ git -C D fsck
72
60
'
73
61
74
- cd " $base_dir "
75
-
76
62
test_expect_success ' breaking of loops' '
77
- echo "$base_dir"/B/.git/objects >>"$base_dir"/A/.git/objects/info/alternatesi &&
78
- cd C &&
79
- git fsck
63
+ echo "$(pwd)"/B/.git/objects >>A/.git/objects/info/alternates &&
64
+ git -C C fsck
80
65
'
81
66
82
- cd " $base_dir "
83
-
84
67
test_expect_success ' that info/alternates is necessary' '
85
- cd C &&
86
- rm -f .git/objects/info/alternates &&
87
- test_must_fail git fsck
68
+ rm -f C/.git/objects/info/alternates &&
69
+ test_must_fail git -C C fsck
88
70
'
89
71
90
- cd " $base_dir "
91
-
92
72
test_expect_success ' that relative alternate is possible for current dir' '
93
- cd C &&
94
- echo "../../../B/.git/objects" > .git/objects/info/alternates &&
73
+ echo "../../../B/.git/objects" >C/.git/objects/info/alternates &&
95
74
git fsck
96
75
'
97
76
98
- cd " $base_dir "
99
-
100
77
test_expect_success ' that relative alternate is only possible for current dir' '
101
- cd D &&
102
- test_must_fail git fsck
78
+ test_must_fail git -C D fsck
103
79
'
104
80
105
- cd " $base_dir "
106
-
107
81
test_done
0 commit comments