Skip to content

Commit 2d60615

Browse files
committed
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 <[email protected]>
1 parent a6c7a27 commit 2d60615

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

t/t3409-rebase-hook.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@ test_expect_success 'pre-rebase hook stops rebase (1)' '
118118
test_expect_success 'pre-rebase hook stops rebase (2)' '
119119
git checkout test &&
120120
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+
) &&
122126
test "z$(git symbolic-ref HEAD)" = zrefs/heads/test &&
123127
test 0 = $(git rev-list HEAD...side | wc -l)
124128
'

t/t3412-rebase-root.sh

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,22 @@ EOF
172172

173173
test_expect_success 'pre-rebase hook stops rebase' '
174174
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+
) &&
176180
test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops1
177181
test 0 = $(git rev-list other...stops1 | wc -l)
178182
'
179183

180184
test_expect_success 'pre-rebase hook stops rebase -i' '
181185
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+
) &&
183191
test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops2
184192
test 0 = $(git rev-list other...stops2 | wc -l)
185193
'
@@ -224,7 +232,11 @@ test_expect_success 'rebase --root with conflict (second part)' '
224232

225233
test_expect_success 'rebase -i --root with conflict (first part)' '
226234
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+
) &&
228240
git ls-files -u | grep "B$"
229241
'
230242

@@ -262,7 +274,11 @@ EOF
262274

263275
test_expect_success 'rebase -i -p --root with conflict (first part)' '
264276
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+
) &&
266282
git ls-files -u | grep "B$"
267283
'
268284

0 commit comments

Comments
 (0)