]> git.ipfire.org Git - thirdparty/git.git/blob - t/t3422-rebase-incompatible-options.sh
checkout: fix "branch info" memory leaks
[thirdparty/git.git] / t / t3422-rebase-incompatible-options.sh
1 #!/bin/sh
2
3 test_description='test if rebase detects and aborts on incompatible options'
4
5 TEST_PASSES_SANITIZE_LEAK=true
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 #
28 # Rebase has lots of useful options like --whitepsace=fix, which are
29 # actually all built in terms of flags to git-am. Since neither
30 # --merge nor --interactive (nor any options that imply those two) use
31 # git-am, using them together will result in flags like --whitespace=fix
32 # being ignored. Make sure rebase warns the user and aborts instead.
33 #
34
35 test_rebase_am_only () {
36 opt=$1
37 shift
38 test_expect_success "$opt incompatible with --merge" "
39 git checkout B^0 &&
40 test_must_fail git rebase $opt --merge A
41 "
42
43 test_expect_success "$opt incompatible with --strategy=ours" "
44 git checkout B^0 &&
45 test_must_fail git rebase $opt --strategy=ours A
46 "
47
48 test_expect_success "$opt incompatible with --strategy-option=ours" "
49 git checkout B^0 &&
50 test_must_fail git rebase $opt --strategy-option=ours A
51 "
52
53 test_expect_success "$opt incompatible with --interactive" "
54 git checkout B^0 &&
55 test_must_fail git rebase $opt --interactive A
56 "
57
58 test_expect_success "$opt incompatible with --exec" "
59 git checkout B^0 &&
60 test_must_fail git rebase $opt --exec 'true' A
61 "
62
63 }
64
65 test_rebase_am_only --whitespace=fix
66 test_rebase_am_only -C4
67
68 test_done