Skip to content

Commit

Permalink
tests: Avoid single-shot environment export for shell function invoca…
Browse files Browse the repository at this point in the history
…tion

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>
  • Loading branch information
Junio C Hamano committed Jan 27, 2009
1 parent a6c7a27 commit 2d60615
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
6 changes: 5 additions & 1 deletion t/t3409-rebase-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ test_expect_success 'pre-rebase hook stops rebase (1)' '
test_expect_success 'pre-rebase hook stops rebase (2)' '
git checkout test &&
git reset --hard side &&
EDITOR=true test_must_fail git rebase -i master &&
(
EDITOR=:
export EDITOR
test_must_fail git rebase -i master
) &&
test "z$(git symbolic-ref HEAD)" = zrefs/heads/test &&
test 0 = $(git rev-list HEAD...side | wc -l)
'
Expand Down
24 changes: 20 additions & 4 deletions t/t3412-rebase-root.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,22 @@ EOF

test_expect_success 'pre-rebase hook stops rebase' '
git checkout -b stops1 other &&
GIT_EDITOR=: test_must_fail git rebase --root --onto master &&
(
GIT_EDITOR=:
export GIT_EDITOR
test_must_fail git rebase --root --onto master
) &&
test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops1
test 0 = $(git rev-list other...stops1 | wc -l)
'

test_expect_success 'pre-rebase hook stops rebase -i' '
git checkout -b stops2 other &&
GIT_EDITOR=: test_must_fail git rebase --root --onto master &&
(
GIT_EDITOR=:
export GIT_EDITOR
test_must_fail git rebase --root --onto master
) &&
test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops2
test 0 = $(git rev-list other...stops2 | wc -l)
'
Expand Down Expand Up @@ -224,7 +232,11 @@ test_expect_success 'rebase --root with conflict (second part)' '

test_expect_success 'rebase -i --root with conflict (first part)' '
git checkout -b conflict2 other &&
GIT_EDITOR=: test_must_fail git rebase -i --root --onto master &&
(
GIT_EDITOR=:
export GIT_EDITOR
test_must_fail git rebase -i --root --onto master
) &&
git ls-files -u | grep "B$"
'

Expand Down Expand Up @@ -262,7 +274,11 @@ EOF

test_expect_success 'rebase -i -p --root with conflict (first part)' '
git checkout -b conflict3 other &&
GIT_EDITOR=: test_must_fail git rebase -i -p --root --onto master &&
(
GIT_EDITOR=:
export GIT_EDITOR
test_must_fail git rebase -i -p --root --onto master
) &&
git ls-files -u | grep "B$"
'

Expand Down

0 comments on commit 2d60615

Please sign in to comment.