3 test_description
='test if rebase detects and aborts on incompatible options'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'setup' '
22 echo "q qfoo();" | q_to_tab >>foo &&
28 # Rebase has a couple options which are specific to the apply backend,
29 # and several options which are specific to the merge backend. Flags
30 # from the different sets cannot work together, and we do not want to
31 # just ignore one of the sets of flags. Make sure rebase warns the
32 # user and aborts instead.
35 test_rebase_am_only
() {
38 test_expect_success
"$opt incompatible with --merge" "
40 test_must_fail git rebase $opt --merge A
43 test_expect_success
"$opt incompatible with --strategy=ours" "
45 test_must_fail git rebase $opt --strategy=ours A
48 test_expect_success
"$opt incompatible with --strategy-option=ours" "
50 test_must_fail git rebase $opt --strategy-option=ours A
53 test_expect_success
"$opt incompatible with --autosquash" "
55 test_must_fail git rebase $opt --autosquash A
58 test_expect_success
"$opt incompatible with --interactive" "
60 test_must_fail git rebase $opt --interactive A
63 test_expect_success
"$opt incompatible with --exec" "
65 test_must_fail git rebase $opt --exec 'true' A
68 test_expect_success
"$opt incompatible with --keep-empty" "
70 test_must_fail git rebase $opt --keep-empty A
73 test_expect_success
"$opt incompatible with --empty=..." "
75 test_must_fail git rebase $opt --empty=ask A
78 test_expect_success
"$opt incompatible with --no-reapply-cherry-picks" "
80 test_must_fail git rebase $opt --no-reapply-cherry-picks A
83 test_expect_success
"$opt incompatible with --reapply-cherry-picks" "
85 test_must_fail git rebase $opt --reapply-cherry-picks A
88 test_expect_success
"$opt incompatible with --update-refs" "
90 test_must_fail git rebase $opt --update-refs A
93 test_expect_success
"$opt incompatible with --root without --onto" "
95 test_must_fail git rebase $opt --root A
98 test_expect_success
"$opt incompatible with rebase.autosquash" "
100 test_must_fail git -c rebase.autosquash=true rebase $opt A 2>err &&
101 grep -e --no-autosquash err
104 test_expect_success
"$opt incompatible with rebase.updateRefs" "
106 test_must_fail git -c rebase.updateRefs=true rebase $opt A 2>err &&
107 grep -e --no-update-refs err
110 test_expect_success
"$opt okay with overridden rebase.autosquash" "
111 test_when_finished \"git reset --hard B^0\" &&
113 git -c rebase.autosquash=true rebase --no-autosquash $opt A
116 test_expect_success
"$opt okay with overridden rebase.updateRefs" "
117 test_when_finished \"git reset --hard B^0\" &&
119 git -c rebase.updateRefs=true rebase --no-update-refs $opt A
123 # Check options which imply --apply
124 test_rebase_am_only
--whitespace=fix
125 test_rebase_am_only
-C4
126 # Also check an explicit --apply
127 test_rebase_am_only
--apply