102
103
test_expect_success 'rebase -i with the exec command checks tree cleanness' '
104
git checkout master &&
105
- (
105
set_fake_editor &&
107
- FAKE_LINES="exec_echo_foo_>file1 1" &&
108
- export FAKE_LINES &&
109
- test_must_fail git rebase -i HEAD^
110
- ) &&
106
+ test_must_fail env FAKE_LINES="exec_echo_foo_>file1 1" git rebase -i HEAD^ &&
107
test_cmp_rev master^ HEAD &&
108
git reset --hard &&
109
git rebase --continue
112
test_expect_success 'rebase -i with exec of inexistent command' '
113
git checkout master &&
114
test_when_finished "git rebase --abort" &&
119
- (
115
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
124
- ) &&
116
+ test_must_fail env FAKE_LINES="exec_this-command-does-not-exist 1" \
117
+ git rebase -i HEAD^ >actual 2>&1 &&
118
! grep "Maybe git-rebase is broken" actual
119
'
120
368
git checkout -b conflict-fixup conflict-branch &&
369
base=$(git rev-parse HEAD~4) &&
370
set_fake_editor &&
378
- (
379
- FAKE_LINES="1 fixup 3 fixup 4" &&
380
- export FAKE_LINES &&
381
- test_must_fail git rebase -i $base
382
- ) &&
371
+ test_must_fail env FAKE_LINES="1 fixup 3 fixup 4" git rebase -i $base &&
372
echo three > conflict &&
373
git add conflict &&
374
FAKE_COMMIT_AMEND="ONCE" EXPECT_HEADER_COUNT=2 \
383
git checkout -b conflict-squash conflict-branch &&
384
base=$(git rev-parse HEAD~4) &&
385
set_fake_editor &&
397
- (
398
- FAKE_LINES="1 fixup 3 squash 4" &&
399
- export FAKE_LINES &&
400
- test_must_fail git rebase -i $base
401
- ) &&
386
+ test_must_fail env FAKE_LINES="1 fixup 3 squash 4" git rebase -i $base &&
387
echo three > conflict &&
388
git add conflict &&
389
FAKE_COMMIT_AMEND="TWICE" EXPECT_HEADER_COUNT=2 \
454
git checkout -b interrupted-squash conflict-branch &&
455
one=$(git rev-parse HEAD~3) &&
456
set_fake_editor &&
472
- (
473
- FAKE_LINES="1 squash 3 2" &&
474
- export FAKE_LINES &&
475
- test_must_fail git rebase -i HEAD~3
476
- ) &&
457
+ test_must_fail env FAKE_LINES="1 squash 3 2" git rebase -i HEAD~3 &&
458
(echo one; echo two; echo four) > conflict &&
459
git add conflict &&
460
test_must_fail git rebase --continue &&
468
git checkout -b interrupted-squash2 conflict-branch &&
469
one=$(git rev-parse HEAD~3) &&
470
set_fake_editor &&
490
- (
491
- FAKE_LINES="3 squash 1 2" &&
492
- export FAKE_LINES &&
493
- test_must_fail git rebase -i HEAD~3
494
- ) &&
471
+ test_must_fail env FAKE_LINES="3 squash 1 2" git rebase -i HEAD~3 &&
472
(echo one; echo four) > conflict &&
473
git add conflict &&
474
test_must_fail git rebase --continue &&
505
FAKE_LINES="edit 1" git rebase -i HEAD^ &&
506
echo "edited again" > file7 &&
507
git add file7 &&
531
- (
532
- FAKE_COMMIT_MESSAGE=" " &&
533
- export FAKE_COMMIT_MESSAGE &&
534
- test_must_fail git rebase --continue
535
- ) &&
508
+ test_must_fail env FAKE_COMMIT_MESSAGE=" " git rebase --continue &&
509
test $old = $(git rev-parse HEAD) &&
510
git rebase --abort
511
'
520
echo "and again" > file7 &&
521
git add file7 &&
522
test_tick &&
550
- (
551
- FAKE_COMMIT_MESSAGE="and again" &&
552
- export FAKE_COMMIT_MESSAGE &&
553
- test_must_fail git rebase --continue
554
- ) &&
523
+ test_must_fail env FAKE_COMMIT_MESSAGE="and again" git rebase --continue &&
524
git rebase --abort
525
'
526
528
test_tick &&
529
test_when_finished "git rebase --abort || :" &&
530
set_fake_editor &&
562
- (
563
- FAKE_LINES="1 exec_false" &&
564
- export FAKE_LINES &&
565
- test_must_fail git rebase -i HEAD^
566
- ) &&
531
+ test_must_fail env FAKE_LINES="1 exec_false" git rebase -i HEAD^ &&
532
echo "edited again" > file7 &&
533
git add file7 &&
534
test_must_fail git rebase --continue 2>error &&
912
913
test_expect_success 'rebase -i --root temporary sentinel commit' '
914
git checkout B &&
950
- (
951
- set_fake_editor &&
952
- FAKE_LINES="2" &&
953
- export FAKE_LINES &&
954
- test_must_fail git rebase -i --root
955
- ) &&
915
+ set_fake_editor &&
916
+ test_must_fail env FAKE_LINES="2" git rebase -i --root &&
917
git cat-file commit HEAD | grep "^tree 4b825dc642cb" &&
918
git rebase --abort
919
'
1003
test_when_finished "git rebase --abort; git reset --hard $current_head; rm -f error" &&
1004
test_commit TO-REMOVE will-conflict old-content &&
1005
test_commit "\temp" will-conflict new-content dummy &&
1045
- (
1046
- EDITOR=true &&
1047
- export EDITOR &&
1048
- test_must_fail git rebase -i HEAD^ --onto HEAD^^ 2>error
1049
- ) &&
1006
+ test_must_fail env EDITOR=true git rebase -i HEAD^ --onto HEAD^^ 2>error &&
1007
test_expect_code 1 grep " emp" error
1008
'
1009