]>
Commit | Line | Data |
---|---|---|
9929430c EN |
1 | #!/bin/sh |
2 | ||
3 | test_description='test if rebase detects and aborts on incompatible options' | |
9081a421 ÆAB |
4 | |
5 | TEST_PASSES_SANITIZE_LEAK=true | |
9929430c EN |
6 | . ./test-lib.sh |
7 | ||
8 | test_expect_success 'setup' ' | |
9 | test_seq 2 9 >foo && | |
10 | git add foo && | |
11 | git commit -m orig && | |
12 | ||
13 | git branch A && | |
14 | git branch B && | |
15 | ||
16 | git checkout A && | |
17 | test_seq 1 9 >foo && | |
18 | git add foo && | |
19 | git commit -m A && | |
20 | ||
21 | git checkout B && | |
22 | echo "q qfoo();" | q_to_tab >>foo && | |
23 | git add foo && | |
24 | git commit -m B | |
25 | ' | |
26 | ||
27 | # | |
1207599e EN |
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. | |
9929430c EN |
33 | # |
34 | ||
35 | test_rebase_am_only () { | |
36 | opt=$1 | |
37 | shift | |
c840e1af | 38 | test_expect_success "$opt incompatible with --merge" " |
9929430c EN |
39 | git checkout B^0 && |
40 | test_must_fail git rebase $opt --merge A | |
41 | " | |
42 | ||
c840e1af | 43 | test_expect_success "$opt incompatible with --strategy=ours" " |
9929430c EN |
44 | git checkout B^0 && |
45 | test_must_fail git rebase $opt --strategy=ours A | |
46 | " | |
47 | ||
c840e1af | 48 | test_expect_success "$opt incompatible with --strategy-option=ours" " |
9929430c EN |
49 | git checkout B^0 && |
50 | test_must_fail git rebase $opt --strategy-option=ours A | |
51 | " | |
52 | ||
c840e1af | 53 | test_expect_success "$opt incompatible with --interactive" " |
9929430c EN |
54 | git checkout B^0 && |
55 | test_must_fail git rebase $opt --interactive A | |
56 | " | |
57 | ||
c840e1af | 58 | test_expect_success "$opt incompatible with --exec" " |
9929430c EN |
59 | git checkout B^0 && |
60 | test_must_fail git rebase $opt --exec 'true' A | |
61 | " | |
62 | ||
1207599e EN |
63 | test_expect_success "$opt incompatible with --update-refs" " |
64 | git checkout B^0 && | |
65 | test_must_fail git rebase $opt --update-refs A | |
66 | " | |
67 | ||
b8ad3656 EN |
68 | test_expect_success "$opt incompatible with --root without --onto" " |
69 | git checkout B^0 && | |
70 | test_must_fail git rebase $opt --root A | |
71 | " | |
9929430c EN |
72 | } |
73 | ||
7d718c55 | 74 | # Check options which imply --apply |
9929430c | 75 | test_rebase_am_only --whitespace=fix |
9929430c | 76 | test_rebase_am_only -C4 |
7d718c55 EN |
77 | # Also check an explicit --apply |
78 | test_rebase_am_only --apply | |
9929430c | 79 | |
9929430c | 80 | test_done |