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