t3404: make tests more self-contained
As its very first action, t3404 installs (via set_fake_editor) a specialized $EDITOR which simplifies automated 'rebase -i' testing. Many tests rely upon this setting, thus tests which need a different editor must take extra care upon completion to restore $EDITOR in order to avoid breaking following tests. This places extra burden upon such tests and requires that they undesirably have extra knowledge about surrounding tests. Ease this burden by having each test install the $EDITOR it requires, rather than relying upon a global setting. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Eric Sunshine committed
Aug 23, 2013 at 20:10 UTC
31cd82752585b95e9682008d454fad7769c1f037
1 file changed
+63
-2
t/t3404-rebase-interactive.sh
+63
-2
@@ -29,8 +29,6 @@ Initial setup:
29
30
. "$TEST_DIRECTORY"/lib-rebase.sh
31
32
-set_fake_editor
33
-
32
# WARNING: Modifications to the initial repository can change the SHA ID used
33
# in the expect2 file for the 'stop on conflicting pick' test.
34
@@ -72,6 +70,7 @@ export SHELL
70
test_expect_success 'rebase -i with the exec command' '
71
git checkout master &&
72
(
73
+ set_fake_editor &&
74
FAKE_LINES="1 exec_>touch-one
75
2 exec_>touch-two exec_false exec_>touch-three
76
3 4 exec_>\"touch-file__name_with_spaces\";_>touch-after-semicolon 5" &&
@@ -93,6 +92,7 @@ test_expect_success 'rebase -i with the exec command' '
92
test_expect_success 'rebase -i with the exec command runs from tree root' '
93
git checkout master &&
94
mkdir subdir && (cd subdir &&
95
+ set_fake_editor &&
96
FAKE_LINES="1 exec_>touch-subdir" \
97
git rebase -i HEAD^
98
) &&
@@ -103,6 +103,7 @@ test_expect_success 'rebase -i with the exec command runs from tree root' '
103
test_expect_success 'rebase -i with the exec command checks tree cleanness' '
104
git checkout master &&
105
(
106
+ set_fake_editor &&
107
FAKE_LINES="exec_echo_foo_>file1 1" &&
108
export FAKE_LINES &&
109
test_must_fail git rebase -i HEAD^
@@ -116,6 +117,7 @@ test_expect_success 'rebase -i with exec of inexistent command' '
117
git checkout master &&
118
test_when_finished "git rebase --abort" &&
119
(
120
+ set_fake_editor &&
121
FAKE_LINES="exec_this-command-does-not-exist 1" &&
122
export FAKE_LINES &&
123
test_must_fail git rebase -i HEAD^ >actual 2>&1
@@ -125,6 +127,7 @@ test_expect_success 'rebase -i with exec of inexistent command' '
127
128
test_expect_success 'no changes are a nop' '
129
git checkout branch2 &&
130
+ set_fake_editor &&
131
git rebase -i F &&
132
test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch2" &&
133
test $(git rev-parse I) = $(git rev-parse HEAD)
@@ -134,6 +137,7 @@ test_expect_success 'test the [branch] option' '
137
git checkout -b dead-end &&
138
git rm file6 &&
139
git commit -m "stop here" &&
140
+ set_fake_editor &&
141
git rebase -i F branch2 &&
142
test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch2" &&
143
test $(git rev-parse I) = $(git rev-parse branch2) &&
@@ -142,6 +146,7 @@ test_expect_success 'test the [branch] option' '
146
147
test_expect_success 'test --onto <branch>' '
148
git checkout -b test-onto branch2 &&
149
+ set_fake_editor &&
150
git rebase -i --onto branch1 F &&
151
test "$(git symbolic-ref -q HEAD)" = "refs/heads/test-onto" &&
152
test $(git rev-parse HEAD^) = $(git rev-parse branch1) &&
@@ -151,6 +156,7 @@ test_expect_success 'test --onto <branch>' '
156
test_expect_success 'rebase on top of a non-conflicting commit' '
157
git checkout branch1 &&
158
git tag original-branch1 &&
159
+ set_fake_editor &&
160
git rebase -i branch2 &&
161
test file6 = $(git diff --name-only original-branch1) &&
162
test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch1" &&
@@ -163,6 +169,7 @@ test_expect_success 'reflog for the branch shows state before rebase' '
169
'
170
171
test_expect_success 'exchange two commits' '
172
+ set_fake_editor &&
173
FAKE_LINES="2 1" git rebase -i HEAD~2 &&
174
test H = $(git cat-file commit HEAD^ | sed -ne \$p) &&
175
test G = $(git cat-file commit HEAD | sed -ne \$p)
@@ -188,6 +195,7 @@ EOF
195
196
test_expect_success 'stop on conflicting pick' '
197
git tag new-branch1 &&
198
+ set_fake_editor &&
199
test_must_fail git rebase -i master &&
200
test "$(git rev-parse HEAD~3)" = "$(git rev-parse master)" &&
201
test_cmp expect .git/rebase-merge/patch &&
@@ -208,6 +216,7 @@ test_expect_success 'abort' '
216
test_expect_success 'abort with error when new base cannot be checked out' '
217
git rm --cached file1 &&
218
git commit -m "remove file in base" &&
219
+ set_fake_editor &&
220
test_must_fail git rebase -i master > output 2>&1 &&
221
grep "The following untracked working tree files would be overwritten by checkout:" \
222
output &&
@@ -222,6 +231,7 @@ test_expect_success 'retain authorship' '
231
test_tick &&
232
GIT_AUTHOR_NAME="Twerp Snog" git commit -m "different author" &&
233
git tag twerp &&
234
+ set_fake_editor &&
235
git rebase -i --onto master HEAD^ &&
236
git show HEAD | grep "^Author: Twerp Snog"
237
'
@@ -232,6 +242,7 @@ test_expect_success 'squash' '
242
test_tick &&
243
GIT_AUTHOR_NAME="Nitfol" git commit -m "nitfol" file7 &&
244
echo "******************************" &&
245
+ set_fake_editor &&
246
FAKE_LINES="1 squash 2" EXPECT_HEADER_COUNT=2 \
247
git rebase -i --onto master HEAD~2 &&
248
test B = $(cat file7) &&
@@ -244,6 +255,7 @@ test_expect_success 'retain authorship when squashing' '
255
256
test_expect_success '-p handles "no changes" gracefully' '
257
HEAD=$(git rev-parse HEAD) &&
258
+ set_fake_editor &&
259
git rebase -i -p HEAD^ &&
260
git update-index --refresh &&
261
git diff-files --quiet &&
@@ -253,6 +265,7 @@ test_expect_success '-p handles "no changes" gracefully' '
265
266
test_expect_failure 'exchange two commits with -p' '
267
git checkout H &&
268
+ set_fake_editor &&
269
FAKE_LINES="2 1" git rebase -i -p HEAD~2 &&
270
test H = $(git cat-file commit HEAD^ | sed -ne \$p) &&
271
test G = $(git cat-file commit HEAD | sed -ne \$p)
@@ -287,6 +300,7 @@ test_expect_success 'preserve merges with -p' '
300
git commit -m M file1 &&
301
git checkout -b to-be-rebased &&
302
test_tick &&
303
+ set_fake_editor &&
304
git rebase -i -p --onto branch1 master &&
305
git update-index --refresh &&
306
git diff-files --quiet &&
@@ -301,6 +315,7 @@ test_expect_success 'preserve merges with -p' '
315
'
316
317
test_expect_success 'edit ancestor with -p' '
318
+ set_fake_editor &&
319
FAKE_LINES="1 2 edit 3 4" git rebase -i -p HEAD~3 &&
320
echo 2 > unrelated-file &&
321
test_tick &&
@@ -314,6 +329,7 @@ test_expect_success 'edit ancestor with -p' '
329
330
test_expect_success '--continue tries to commit' '
331
test_tick &&
332
+ set_fake_editor &&
333
test_must_fail git rebase -i --onto new-branch1 HEAD^ &&
334
echo resolved > file1 &&
335
git add file1 &&
@@ -325,6 +341,7 @@ test_expect_success '--continue tries to commit' '
341
test_expect_success 'verbose flag is heeded, even after --continue' '
342
git reset --hard master@{1} &&
343
test_tick &&
344
+ set_fake_editor &&
345
test_must_fail git rebase -v -i --onto new-branch1 HEAD^ &&
346
echo resolved > file1 &&
347
git add file1 &&
@@ -334,6 +351,7 @@ test_expect_success 'verbose flag is heeded, even after --continue' '
351
352
test_expect_success 'multi-squash only fires up editor once' '
353
base=$(git rev-parse HEAD~4) &&
354
+ set_fake_editor &&
355
FAKE_COMMIT_AMEND="ONCE" FAKE_LINES="1 squash 2 squash 3 squash 4" \
356
EXPECT_HEADER_COUNT=4 \
357
git rebase -i $base &&
@@ -344,6 +362,7 @@ test_expect_success 'multi-squash only fires up editor once' '
362
test_expect_success 'multi-fixup does not fire up editor' '
363
git checkout -b multi-fixup E &&
364
base=$(git rev-parse HEAD~4) &&
365
+ set_fake_editor &&
366
FAKE_COMMIT_AMEND="NEVER" FAKE_LINES="1 fixup 2 fixup 3 fixup 4" \
367
git rebase -i $base &&
368
test $base = $(git rev-parse HEAD^) &&
@@ -355,6 +374,7 @@ test_expect_success 'multi-fixup does not fire up editor' '
374
test_expect_success 'commit message used after conflict' '
375
git checkout -b conflict-fixup conflict-branch &&
376
base=$(git rev-parse HEAD~4) &&
377
+ set_fake_editor &&
378
(
379
FAKE_LINES="1 fixup 3 fixup 4" &&
380
export FAKE_LINES &&
@@ -373,6 +393,7 @@ test_expect_success 'commit message used after conflict' '
393
test_expect_success 'commit message retained after conflict' '
394
git checkout -b conflict-squash conflict-branch &&
395
base=$(git rev-parse HEAD~4) &&
396
+ set_fake_editor &&
397
(
398
FAKE_LINES="1 fixup 3 squash 4" &&
399
export FAKE_LINES &&
@@ -399,6 +420,7 @@ EOF
420
test_expect_success 'squash and fixup generate correct log messages' '
421
git checkout -b squash-fixup E &&
422
base=$(git rev-parse HEAD~4) &&
423
+ set_fake_editor &&
424
FAKE_COMMIT_AMEND="ONCE" FAKE_LINES="1 fixup 2 squash 3 fixup 4" \
425
EXPECT_HEADER_COUNT=4 \
426
git rebase -i $base &&
@@ -411,6 +433,7 @@ test_expect_success 'squash and fixup generate correct log messages' '
433
test_expect_success 'squash ignores comments' '
434
git checkout -b skip-comments E &&
435
base=$(git rev-parse HEAD~4) &&
436
+ set_fake_editor &&
437
FAKE_COMMIT_AMEND="ONCE" FAKE_LINES="# 1 # squash 2 # squash 3 # squash 4 #" \
438
EXPECT_HEADER_COUNT=4 \
439
git rebase -i $base &&
@@ -423,6 +446,7 @@ test_expect_success 'squash ignores comments' '
446
test_expect_success 'squash ignores blank lines' '
447
git checkout -b skip-blank-lines E &&
448
base=$(git rev-parse HEAD~4) &&
449
+ set_fake_editor &&
450
FAKE_COMMIT_AMEND="ONCE" FAKE_LINES="> 1 > squash 2 > squash 3 > squash 4 >" \
451
EXPECT_HEADER_COUNT=4 \
452
git rebase -i $base &&
@@ -435,6 +459,7 @@ test_expect_success 'squash ignores blank lines' '
459
test_expect_success 'squash works as expected' '
460
git checkout -b squash-works no-conflict-branch &&
461
one=$(git rev-parse HEAD~3) &&
462
+ set_fake_editor &&
463
FAKE_LINES="1 squash 3 2" EXPECT_HEADER_COUNT=2 \
464
git rebase -i HEAD~3 &&
465
test $one = $(git rev-parse HEAD~2)
@@ -443,6 +468,7 @@ test_expect_success 'squash works as expected' '
468
test_expect_success 'interrupted squash works as expected' '
469
git checkout -b interrupted-squash conflict-branch &&
470
one=$(git rev-parse HEAD~3) &&
471
+ set_fake_editor &&
472
(
473
FAKE_LINES="1 squash 3 2" &&
474
export FAKE_LINES &&
@@ -460,6 +486,7 @@ test_expect_success 'interrupted squash works as expected' '
486
test_expect_success 'interrupted squash works as expected (case 2)' '
487
git checkout -b interrupted-squash2 conflict-branch &&
488
one=$(git rev-parse HEAD~3) &&
489
+ set_fake_editor &&
490
(
491
FAKE_LINES="3 squash 1 2" &&
492
export FAKE_LINES &&
@@ -484,6 +511,7 @@ test_expect_success '--continue tries to commit, even for "edit"' '
511
git commit -m "unrelated change" &&
512
parent=$(git rev-parse HEAD^) &&
513
test_tick &&
514
+ set_fake_editor &&
515
FAKE_LINES="edit 1" git rebase -i HEAD^ &&
516
echo edited > file7 &&
517
git add file7 &&
@@ -496,6 +524,7 @@ test_expect_success '--continue tries to commit, even for "edit"' '
524
test_expect_success 'aborted --continue does not squash commits after "edit"' '
525
old=$(git rev-parse HEAD) &&
526
test_tick &&
527
+ set_fake_editor &&
528
FAKE_LINES="edit 1" git rebase -i HEAD^ &&
529
echo "edited again" > file7 &&
530
git add file7 &&
@@ -510,6 +539,7 @@ test_expect_success 'aborted --continue does not squash commits after "edit"' '
539
540
test_expect_success 'auto-amend only edited commits after "edit"' '
541
test_tick &&
542
+ set_fake_editor &&
543
FAKE_LINES="edit 1" git rebase -i HEAD^ &&
544
echo "edited again" > file7 &&
545
git add file7 &&
@@ -528,6 +558,7 @@ test_expect_success 'auto-amend only edited commits after "edit"' '
558
test_expect_success 'clean error after failed "exec"' '
559
test_tick &&
560
test_when_finished "git rebase --abort || :" &&
561
+ set_fake_editor &&
562
(
563
FAKE_LINES="1 exec_false" &&
564
export FAKE_LINES &&
@@ -543,6 +574,7 @@ test_expect_success 'rebase a detached HEAD' '
574
grandparent=$(git rev-parse HEAD~2) &&
575
git checkout $(git rev-parse HEAD) &&
576
test_tick &&
577
+ set_fake_editor &&
578
FAKE_LINES="2 1" git rebase -i HEAD~2 &&
579
test $grandparent = $(git rev-parse HEAD~2)
580
'
@@ -559,6 +591,7 @@ test_expect_success 'rebase a commit violating pre-commit' '
591
test_must_fail git commit -m doesnt-verify file1 &&
592
git commit -m doesnt-verify --no-verify file1 &&
593
test_tick &&
594
+ set_fake_editor &&
595
FAKE_LINES=2 git rebase -i HEAD~2
596
597
'
@@ -580,6 +613,7 @@ test_expect_success 'rebase with a file named HEAD in worktree' '
613
git commit -m "Add body"
614
) &&
615
616
+ set_fake_editor &&
617
FAKE_LINES="1 squash 2" git rebase -i to-be-rebased &&
618
test "$(git show -s --pretty=format:%an)" = "Squashed Away"
619
@@ -591,6 +625,7 @@ test_expect_success 'do "noop" when there is nothing to cherry-pick' '
625
GIT_EDITOR=: git commit --amend \
626
--author="Somebody else <somebody@else.com>" &&
627
test $(git rev-parse branch3) != $(git rev-parse branch4) &&
628
+ set_fake_editor &&
629
git rebase -i branch3 &&
630
test $(git rev-parse branch3) = $(git rev-parse branch4)
631
@@ -615,10 +650,12 @@ test_expect_success 'submodule rebase setup' '
650
git commit -a -m "submodule second"
651
) &&
652
test_tick &&
653
+ set_fake_editor &&
654
git commit -a -m "Three changes submodule"
655
'
656
657
test_expect_success 'submodule rebase -i' '
658
+ set_fake_editor &&
659
FAKE_LINES="1 squash 2 3" git rebase -i A
660
'
661
@@ -636,6 +673,7 @@ test_expect_success 'submodule conflict setup' '
673
'
674
675
test_expect_success 'rebase -i continue with only submodule staged' '
676
+ set_fake_editor &&
677
test_must_fail git rebase -i submodule-base &&
678
git add sub &&
679
git rebase --continue &&
@@ -645,6 +683,7 @@ test_expect_success 'rebase -i continue with only submodule staged' '
683
test_expect_success 'rebase -i continue with unstaged submodule' '
684
git checkout submodule-topic &&
685
git reset --hard &&
686
+ set_fake_editor &&
687
test_must_fail git rebase -i submodule-base &&
688
git reset &&
689
git rebase --continue &&
@@ -657,6 +696,7 @@ test_expect_success 'avoid unnecessary reset' '
696
test-chmtime =123456789 file3 &&
697
git update-index --refresh &&
698
HEAD=$(git rev-parse HEAD) &&
699
+ set_fake_editor &&
700
git rebase -i HEAD~4 &&
701
test $HEAD = $(git rev-parse HEAD) &&
702
MTIME=$(test-chmtime -v +0 file3 | sed 's/[^0-9].*$//') &&
@@ -665,6 +705,7 @@ test_expect_success 'avoid unnecessary reset' '
705
706
test_expect_success 'reword' '
707
git checkout -b reword-branch master &&
708
+ set_fake_editor &&
709
FAKE_LINES="1 2 3 reword 4" FAKE_COMMIT_MESSAGE="E changed" git rebase -i A &&
710
git show HEAD | grep "E changed" &&
711
test $(git rev-parse master) != $(git rev-parse HEAD) &&
@@ -684,6 +725,7 @@ test_expect_success 'rebase -i can copy notes' '
725
test_commit n2 &&
726
test_commit n3 &&
727
git notes add -m"a note" n3 &&
728
+ set_fake_editor &&
729
git rebase -i --onto n1 n2 &&
730
test "a note" = "$(git notes show HEAD)"
731
'
@@ -697,6 +739,7 @@ EOF
739
test_expect_success 'rebase -i can copy notes over a fixup' '
740
git reset --hard n3 &&
741
git notes add -m"an earlier note" n2 &&
742
+ set_fake_editor &&
743
GIT_NOTES_REWRITE_MODE=concatenate FAKE_LINES="1 fixup 2" git rebase -i n1 &&
744
git notes show > output &&
745
test_cmp expect output
@@ -706,6 +749,7 @@ test_expect_success 'rebase while detaching HEAD' '
749
git symbolic-ref HEAD &&
750
grandparent=$(git rev-parse HEAD~2) &&
751
test_tick &&
752
+ set_fake_editor &&
753
FAKE_LINES="2 1" git rebase -i HEAD~2 HEAD^0 &&
754
test $grandparent = $(git rev-parse HEAD~2) &&
755
test_must_fail git symbolic-ref HEAD
@@ -715,6 +759,7 @@ test_tick # Ensure that the rebased commits get a different timestamp.
759
test_expect_success 'always cherry-pick with --no-ff' '
760
git checkout no-ff-branch &&
761
git tag original-no-ff-branch &&
762
+ set_fake_editor &&
763
git rebase -i --no-ff A &&
764
touch empty &&
765
for p in 0 1 2
@@ -747,6 +792,7 @@ test_expect_success 'set up commits with funny messages' '
792
test_expect_success 'rebase-i history with funny messages' '
793
git rev-list A..funny >expect &&
794
test_tick &&
795
+ set_fake_editor &&
796
FAKE_LINES="1 2 3 4" git rebase -i A &&
797
git rev-list A.. >actual &&
798
test_cmp expect actual
@@ -763,6 +809,7 @@ test_expect_success 'prepare for rebase -i --exec' '
809
810
811
test_expect_success 'running "git rebase -i --exec git show HEAD"' '
812
+ set_fake_editor &&
813
git rebase -i --exec "git show HEAD" HEAD~2 >actual &&
814
(
815
FAKE_LINES="1 exec_git_show_HEAD 2 exec_git_show_HEAD" &&
@@ -776,6 +823,7 @@ test_expect_success 'running "git rebase -i --exec git show HEAD"' '
823
824
test_expect_success 'running "git rebase --exec git show HEAD -i"' '
825
git reset --hard execute &&
826
+ set_fake_editor &&
827
git rebase --exec "git show HEAD" -i HEAD~2 >actual &&
828
(
829
FAKE_LINES="1 exec_git_show_HEAD 2 exec_git_show_HEAD" &&
@@ -789,6 +837,7 @@ test_expect_success 'running "git rebase --exec git show HEAD -i"' '
837
838
test_expect_success 'running "git rebase -ix git show HEAD"' '
839
git reset --hard execute &&
840
+ set_fake_editor &&
841
git rebase -ix "git show HEAD" HEAD~2 >actual &&
842
(
843
FAKE_LINES="1 exec_git_show_HEAD 2 exec_git_show_HEAD" &&
@@ -802,6 +851,7 @@ test_expect_success 'running "git rebase -ix git show HEAD"' '
851
852
test_expect_success 'rebase -ix with several <CMD>' '
853
git reset --hard execute &&
854
+ set_fake_editor &&
855
git rebase -ix "git show HEAD; pwd" HEAD~2 >actual &&
856
(
857
FAKE_LINES="1 exec_git_show_HEAD;_pwd 2 exec_git_show_HEAD;_pwd" &&
@@ -815,6 +865,7 @@ test_expect_success 'rebase -ix with several <CMD>' '
865
866
test_expect_success 'rebase -ix with several instances of --exec' '
867
git reset --hard execute &&
868
+ set_fake_editor &&
869
git rebase -i --exec "git show HEAD" --exec "pwd" HEAD~2 >actual &&
870
(
871
FAKE_LINES="1 exec_git_show_HEAD exec_pwd 2
@@ -836,6 +887,7 @@ test_expect_success 'rebase -ix with --autosquash' '
887
echo bis >bis.txt &&
888
git add bis.txt &&
889
git commit -m "fixup! two_exec" &&
890
+ set_fake_editor &&
891
(
892
git checkout -b autosquash_actual &&
893
git rebase -i --exec "git show HEAD" --autosquash HEAD~4 >actual
@@ -854,6 +906,7 @@ test_expect_success 'rebase -ix with --autosquash' '
906
907
test_expect_success 'rebase --exec without -i shows error message' '
908
git reset --hard execute &&
909
+ set_fake_editor &&
910
test_must_fail git rebase --exec "git show HEAD" HEAD~2 2>actual &&
911
echo "The --exec option must be used with the --interactive option" >expected &&
912
test_i18ncmp expected actual
@@ -862,6 +915,7 @@ test_expect_success 'rebase --exec without -i shows error message' '
915
916
test_expect_success 'rebase -i --exec without <CMD>' '
917
git reset --hard execute &&
918
+ set_fake_editor &&
919
test_must_fail git rebase -i --exec 2>tmp &&
920
sed -e "1d" tmp >actual &&
921
test_must_fail git rebase -h >expected &&
@@ -871,6 +925,7 @@ test_expect_success 'rebase -i --exec without <CMD>' '
925
926
test_expect_success 'rebase -i --root re-order and drop commits' '
927
git checkout E &&
928
+ set_fake_editor &&
929
FAKE_LINES="3 1 2 5" git rebase -i --root &&
930
test E = $(git cat-file commit HEAD | sed -ne \$p) &&
931
test B = $(git cat-file commit HEAD^ | sed -ne \$p) &&
@@ -884,6 +939,7 @@ test_expect_success 'rebase -i --root retain root commit author and message' '
939
echo B >file7 &&
940
git add file7 &&
941
GIT_AUTHOR_NAME="Twerp Snog" git commit -m "different author" &&
942
+ set_fake_editor &&
943
FAKE_LINES="2" git rebase -i --root &&
944
git cat-file commit HEAD | grep -q "^author Twerp Snog" &&
945
git cat-file commit HEAD | grep -q "^different author$"
@@ -892,6 +948,7 @@ test_expect_success 'rebase -i --root retain root commit author and message' '
948
test_expect_success 'rebase -i --root temporary sentinel commit' '
949
git checkout B &&
950
(
951
+ set_fake_editor &&
952
FAKE_LINES="2" &&
953
export FAKE_LINES &&
954
test_must_fail git rebase -i --root
@@ -902,6 +959,7 @@ test_expect_success 'rebase -i --root temporary sentinel commit' '
959
960
test_expect_success 'rebase -i --root fixup root commit' '
961
git checkout B &&
962
+ set_fake_editor &&
963
FAKE_LINES="1 fixup 2" git rebase -i --root &&
964
test A = $(git cat-file commit HEAD | sed -ne \$p) &&
965
test B = $(git show HEAD:file1) &&
@@ -911,6 +969,7 @@ test_expect_success 'rebase -i --root fixup root commit' '
969
test_expect_success 'rebase --edit-todo does not works on non-interactive rebase' '
970
git reset --hard &&
971
git checkout conflict-branch &&
972
+ set_fake_editor &&
973
test_must_fail git rebase --onto HEAD~2 HEAD~ &&
974
test_must_fail git rebase --edit-todo &&
975
git rebase --abort
@@ -919,6 +978,7 @@ test_expect_success 'rebase --edit-todo does not works on non-interactive rebase
978
test_expect_success 'rebase --edit-todo can be used to modify todo' '
979
git reset --hard &&
980
git checkout no-conflict-branch^0 &&
981
+ set_fake_editor &&
982
FAKE_LINES="edit 1 2 3" git rebase -i HEAD~3 &&
983
FAKE_LINES="2 1" git rebase --edit-todo &&
984
git rebase --continue
@@ -929,6 +989,7 @@ test_expect_success 'rebase --edit-todo can be used to modify todo' '
989
test_expect_success 'rebase -i produces readable reflog' '
990
git reset --hard &&
991
git branch -f branch-reflog-test H &&
992
+ set_fake_editor &&
993
git rebase -i --onto I F branch-reflog-test &&
994
cat >expect <<-\EOF &&
995
rebase -i (start): checkout I