restore: replace --force with --ignore-unmerged
[git.git] / t / t3410-rebase-preserve-dropped-merges.sh
blob2e29866993ce80a19ecbef55e6dab829009b0a11
1 #!/bin/sh
3 # Copyright (c) 2008 Stephen Haberman
6 test_description='git rebase preserve merges
8 This test runs git rebase with preserve merges and ensures commits
9 dropped by the --cherry-pick flag have their childrens parents
10 rewritten.
12 . ./test-lib.sh
14 if ! test_have_prereq REBASE_P; then
15 skip_all='skipping git rebase -p tests, as asked for'
16 test_done
19 # set up two branches like this:
21 # A - B - C - D - E
22 # \
23 # F - G - H
24 # \
25 # I
27 # where B, D and G touch the same file.
29 test_expect_success 'setup' '
30 test_commit A file1 &&
31 test_commit B file1 1 &&
32 test_commit C file2 &&
33 test_commit D file1 2 &&
34 test_commit E file3 &&
35 git checkout A &&
36 test_commit F file4 &&
37 test_commit G file1 3 &&
38 test_commit H file5 &&
39 git checkout F &&
40 test_commit I file6
43 # A - B - C - D - E
44 # \ \ \
45 # F - G - H -- L \ --> L
46 # \ | \
47 # I -- G2 -- J -- K I -- K
48 # G2 = same changes as G
49 test_expect_success 'skip same-resolution merges with -p' '
50 git checkout H &&
51 test_must_fail git merge E &&
52 test_commit L file1 23 &&
53 git checkout I &&
54 test_commit G2 file1 3 &&
55 test_must_fail git merge E &&
56 test_commit J file1 23 &&
57 test_commit K file7 file7 &&
58 git rebase -i -p L &&
59 test $(git rev-parse HEAD^^) = $(git rev-parse L) &&
60 test "23" = "$(cat file1)" &&
61 test "I" = "$(cat file6)" &&
62 test "file7" = "$(cat file7)"
65 # A - B - C - D - E
66 # \ \ \
67 # F - G - H -- L2 \ --> L2
68 # \ | \
69 # I -- G3 --- J2 -- K2 I -- G3 -- K2
70 # G2 = different changes as G
71 test_expect_success 'keep different-resolution merges with -p' '
72 git checkout H &&
73 test_must_fail git merge E &&
74 test_commit L2 file1 23 &&
75 git checkout I &&
76 test_commit G3 file1 4 &&
77 test_must_fail git merge E &&
78 test_commit J2 file1 24 &&
79 test_commit K2 file7 file7 &&
80 test_must_fail git rebase -i -p L2 &&
81 echo 234 > file1 &&
82 git add file1 &&
83 git rebase --continue &&
84 test $(git rev-parse HEAD^^^) = $(git rev-parse L2) &&
85 test "234" = "$(cat file1)" &&
86 test "I" = "$(cat file6)" &&
87 test "file7" = "$(cat file7)"
90 test_done