@@ -16,123 +16,133 @@ test_expect_success setup '
16
16
cp one original.one &&
17
17
cp dir/two original.two
18
18
'
19
- HERE=` pwd`
20
19
LF='
21
20
'
22
21
23
22
test_expect_success ' update-index and ls-files' '
24
- cd "$HERE" &&
25
23
git update-index --add one &&
26
24
case "`git ls-files`" in
27
25
one) echo pass one ;;
28
26
*) echo bad one; exit 1 ;;
29
27
esac &&
30
- cd dir &&
31
- git update-index --add two &&
32
- case "`git ls-files`" in
33
- two) echo pass two ;;
34
- *) echo bad two; exit 1 ;;
35
- esac &&
36
- cd .. &&
28
+ (
29
+ cd dir &&
30
+ git update-index --add two &&
31
+ case "`git ls-files`" in
32
+ two) echo pass two ;;
33
+ *) echo bad two; exit 1 ;;
34
+ esac
35
+ ) &&
37
36
case "`git ls-files`" in
38
37
dir/two"$LF"one) echo pass both ;;
39
38
*) echo bad; exit 1 ;;
40
39
esac
41
40
'
42
41
43
42
test_expect_success ' cat-file' '
44
- cd "$HERE" &&
45
43
two=`git ls-files -s dir/two` &&
46
44
two=`expr "$two" : "[0-7]* \\([0-9a-f]*\\)"` &&
47
45
echo "$two" &&
48
46
git cat-file -p "$two" >actual &&
49
47
cmp dir/two actual &&
50
- cd dir &&
51
- git cat-file -p "$two" >actual &&
52
- cmp two actual
48
+ (
49
+ cd dir &&
50
+ git cat-file -p "$two" >actual &&
51
+ cmp two actual
52
+ )
53
53
'
54
54
rm -f actual dir/actual
55
55
56
56
test_expect_success ' diff-files' '
57
- cd "$HERE" &&
58
57
echo a >>one &&
59
58
echo d >>dir/two &&
60
59
case "`git diff-files --name-only`" in
61
60
dir/two"$LF"one) echo pass top ;;
62
61
*) echo bad top; exit 1 ;;
63
62
esac &&
64
63
# diff should not omit leading paths
65
- cd dir &&
66
- case "`git diff-files --name-only`" in
67
- dir/two"$LF"one) echo pass subdir ;;
68
- *) echo bad subdir; exit 1 ;;
69
- esac &&
70
- case "`git diff-files --name-only .`" in
71
- dir/two) echo pass subdir limited ;;
72
- *) echo bad subdir limited; exit 1 ;;
73
- esac
64
+ (
65
+ cd dir &&
66
+ case "`git diff-files --name-only`" in
67
+ dir/two"$LF"one) echo pass subdir ;;
68
+ *) echo bad subdir; exit 1 ;;
69
+ esac &&
70
+ case "`git diff-files --name-only .`" in
71
+ dir/two) echo pass subdir limited ;;
72
+ *) echo bad subdir limited; exit 1 ;;
73
+ esac
74
+ )
74
75
'
75
76
76
77
test_expect_success ' write-tree' '
77
- cd "$HERE" &&
78
78
top=`git write-tree` &&
79
79
echo $top &&
80
- cd dir &&
81
- sub=`git write-tree` &&
82
- echo $sub &&
83
- test "z$top" = "z$sub"
80
+ (
81
+ cd dir &&
82
+ sub=`git write-tree` &&
83
+ echo $sub &&
84
+ test "z$top" = "z$sub"
85
+ )
84
86
'
85
87
86
88
test_expect_success ' checkout-index' '
87
- cd "$HERE" &&
88
89
git checkout-index -f -u one &&
89
90
cmp one original.one &&
90
- cd dir &&
91
- git checkout-index -f -u two &&
92
- cmp two ../original.two
91
+ (
92
+ cd dir &&
93
+ git checkout-index -f -u two &&
94
+ cmp two ../original.two
95
+ )
93
96
'
94
97
95
98
test_expect_success ' read-tree' '
96
- cd "$HERE" &&
97
99
rm -f one dir/two &&
98
100
tree=`git write-tree` &&
99
101
git read-tree --reset -u "$tree" &&
100
102
cmp one original.one &&
101
103
cmp dir/two original.two &&
102
- cd dir &&
103
- rm -f two &&
104
- git read-tree --reset -u "$tree" &&
105
- cmp two ../original.two &&
106
- cmp ../one ../original.one
104
+ (
105
+ cd dir &&
106
+ rm -f two &&
107
+ git read-tree --reset -u "$tree" &&
108
+ cmp two ../original.two &&
109
+ cmp ../one ../original.one
110
+ )
107
111
'
108
112
109
113
test_expect_success ' no file/rev ambiguity check inside .git' '
110
- cd "$HERE" &&
111
114
git commit -a -m 1 &&
112
- cd "$HERE"/.git &&
113
- git show -s HEAD
115
+ (
116
+ cd .git &&
117
+ git show -s HEAD
118
+ )
114
119
'
115
120
116
121
test_expect_success ' no file/rev ambiguity check inside a bare repo' '
117
- cd "$HERE" &&
118
122
git clone -s --bare .git foo.git &&
119
- cd foo.git && GIT_DIR=. git show -s HEAD
123
+ (
124
+ cd foo.git &&
125
+ GIT_DIR=. git show -s HEAD
126
+ )
120
127
'
121
128
122
129
# This still does not work as it should...
123
130
: test_expect_success ' no file/rev ambiguity check inside a bare repo' '
124
- cd "$HERE" &&
125
131
git clone -s --bare .git foo.git &&
126
- cd foo.git && git show -s HEAD
132
+ (
133
+ cd foo.git &&
134
+ git show -s HEAD
135
+ )
127
136
'
128
137
129
138
test_expect_success SYMLINKS ' detection should not be fooled by a symlink' '
130
- cd "$HERE" &&
131
139
rm -fr foo.git &&
132
140
git clone -s .git another &&
133
141
ln -s another yetanother &&
134
- cd yetanother/.git &&
135
- git show -s HEAD
142
+ (
143
+ cd yetanother/.git &&
144
+ git show -s HEAD
145
+ )
136
146
'
137
147
138
148
test_done
0 commit comments