Skip to content

Commit 05ec418

Browse files
phillipwoodgitster
authored andcommitted
t3416: set $EDITOR in subshell
As $EDITOR is exported, setting it in one test affects all subsequent tests. Avoid this by always setting it in a subshell. Also remove a couple of unnecessary call to set_fake_editor where the editor does not change the todo list. Signed-off-by: Phillip Wood <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 96601a2 commit 05ec418

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

t/t3416-rebase-onto-threedots.sh

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@ test_expect_success 'rebase -i --onto main...topic' '
7979
git reset --hard &&
8080
git checkout topic &&
8181
git reset --hard G &&
82-
set_fake_editor &&
83-
EXPECT_COUNT=1 git rebase -i --onto main...topic F &&
82+
(
83+
set_fake_editor &&
84+
EXPECT_COUNT=1 git rebase -i --onto main...topic F
85+
) &&
8486
git rev-parse HEAD^1 >actual &&
8587
git rev-parse C^0 >expect &&
8688
test_cmp expect actual
@@ -90,8 +92,10 @@ test_expect_success 'rebase -i --onto main...' '
9092
git reset --hard &&
9193
git checkout topic &&
9294
git reset --hard G &&
93-
set_fake_editor &&
94-
EXPECT_COUNT=1 git rebase -i --onto main... F &&
95+
(
96+
set_fake_editor &&
97+
EXPECT_COUNT=1 git rebase -i --onto main... F
98+
) &&
9599
git rev-parse HEAD^1 >actual &&
96100
git rev-parse C^0 >expect &&
97101
test_cmp expect actual
@@ -102,7 +106,6 @@ test_expect_success 'rebase --onto main...side requires a single merge-base' '
102106
git checkout side &&
103107
git reset --hard K &&
104108
105-
set_fake_editor &&
106109
test_must_fail git rebase -i --onto main...side J 2>err &&
107110
grep "need exactly one merge base" err
108111
'
@@ -157,8 +160,10 @@ test_expect_success 'rebase -i --keep-base main from topic' '
157160
git checkout topic &&
158161
git reset --hard G &&
159162
160-
set_fake_editor &&
161-
EXPECT_COUNT=2 git rebase -i --keep-base main &&
163+
(
164+
set_fake_editor &&
165+
EXPECT_COUNT=2 git rebase -i --keep-base main
166+
) &&
162167
git rev-parse C >base.expect &&
163168
git merge-base main HEAD >base.actual &&
164169
test_cmp base.expect base.actual &&
@@ -172,8 +177,10 @@ test_expect_success 'rebase -i --keep-base main topic from main' '
172177
git checkout main &&
173178
git branch -f topic G &&
174179
175-
set_fake_editor &&
176-
EXPECT_COUNT=2 git rebase -i --keep-base main topic &&
180+
(
181+
set_fake_editor &&
182+
EXPECT_COUNT=2 git rebase -i --keep-base main topic
183+
) &&
177184
git rev-parse C >base.expect &&
178185
git merge-base main HEAD >base.actual &&
179186
test_cmp base.expect base.actual &&
@@ -188,9 +195,13 @@ test_expect_success 'rebase --keep-base requires a single merge base' '
188195
git checkout side &&
189196
git reset --hard K &&
190197
191-
set_fake_editor &&
192198
test_must_fail git rebase -i --keep-base main 2>err &&
193199
grep "need exactly one merge base with branch" err
194200
'
195201

202+
# This must be the last test in this file
203+
test_expect_success '$EDITOR and friends are unchanged' '
204+
test_editor_unchanged
205+
'
206+
196207
test_done

0 commit comments

Comments
 (0)