tests: Avoid single-shot environment export for shell function invocation
Some shells have issues with a single-shot environment variable export when invoking a shell function. This fixes the ones I found that invoke test_must_fail that way. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jan 26, 2009 at 21:13 UTC
2d6061537f3f27112f80a6e1047b5c566084ef7d
2 files changed
+25
-5
t/t3409-rebase-hook.sh
+5
-1
@@ -118,7 +118,11 @@ test_expect_success 'pre-rebase hook stops rebase (1)' '
118
test_expect_success 'pre-rebase hook stops rebase (2)' '
119
git checkout test &&
120
git reset --hard side &&
121
- EDITOR=true test_must_fail git rebase -i master &&
121
+ (
122
+ EDITOR=:
123
+ export EDITOR
124
+ test_must_fail git rebase -i master
125
+ ) &&
126
test "z$(git symbolic-ref HEAD)" = zrefs/heads/test &&
127
test 0 = $(git rev-list HEAD...side | wc -l)
128
'
t/t3412-rebase-root.sh
+20
-4
@@ -172,14 +172,22 @@ EOF
172
173
test_expect_success 'pre-rebase hook stops rebase' '
174
git checkout -b stops1 other &&
175
- GIT_EDITOR=: test_must_fail git rebase --root --onto master &&
175
+ (
176
+ GIT_EDITOR=:
177
+ export GIT_EDITOR
178
+ test_must_fail git rebase --root --onto master
179
+ ) &&
180
test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops1
181
test 0 = $(git rev-list other...stops1 | wc -l)
182
'
183
184
test_expect_success 'pre-rebase hook stops rebase -i' '
185
git checkout -b stops2 other &&
182
- GIT_EDITOR=: test_must_fail git rebase --root --onto master &&
186
+ (
187
+ GIT_EDITOR=:
188
+ export GIT_EDITOR
189
+ test_must_fail git rebase --root --onto master
190
+ ) &&
191
test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops2
192
test 0 = $(git rev-list other...stops2 | wc -l)
193
'
@@ -224,7 +232,11 @@ test_expect_success 'rebase --root with conflict (second part)' '
232
233
test_expect_success 'rebase -i --root with conflict (first part)' '
234
git checkout -b conflict2 other &&
227
- GIT_EDITOR=: test_must_fail git rebase -i --root --onto master &&
235
+ (
236
+ GIT_EDITOR=:
237
+ export GIT_EDITOR
238
+ test_must_fail git rebase -i --root --onto master
239
+ ) &&
240
git ls-files -u | grep "B$"
241
'
242
@@ -262,7 +274,11 @@ EOF
274
275
test_expect_success 'rebase -i -p --root with conflict (first part)' '
276
git checkout -b conflict3 other &&
265
- GIT_EDITOR=: test_must_fail git rebase -i -p --root --onto master &&
277
+ (
278
+ GIT_EDITOR=:
279
+ export GIT_EDITOR
280
+ test_must_fail git rebase -i -p --root --onto master
281
+ ) &&
282
git ls-files -u | grep "B$"
283
'
284