git stash: make sure that .git/logs/refs/ exists
[git/mingw/4msysgit.git] / t / t3410-rebase-preserve-dropped-merges.sh
blob6f73b95558c85264d073d42f67c407967c4d5c69
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 # set up two branches like this:
16 # A - B - C - D - E
17 # \
18 # F - G - H
19 # \
20 # I
22 # where B, D and G touch the same file.
24 test_expect_success 'setup' '
25 test_commit A file1 &&
26 test_commit B file1 1 &&
27 test_commit C file2 &&
28 test_commit D file1 2 &&
29 test_commit E file3 &&
30 git checkout A &&
31 test_commit F file4 &&
32 test_commit G file1 3 &&
33 test_commit H file5 &&
34 git checkout F &&
35 test_commit I file6
38 # A - B - C - D - E
39 # \ \ \
40 # F - G - H -- L \ --> L
41 # \ | \
42 # I -- G2 -- J -- K I -- K
43 # G2 = same changes as G
44 test_expect_success 'skip same-resolution merges with -p' '
45 git checkout H &&
46 test_must_fail git merge E &&
47 test_commit L file1 23 &&
48 git checkout I &&
49 test_commit G2 file1 3 &&
50 test_must_fail git merge E &&
51 test_commit J file1 23 &&
52 test_commit K file7 file7 &&
53 git rebase -i -p L &&
54 test $(git rev-parse HEAD^^) = $(git rev-parse L) &&
55 test "23" = "$(cat file1)" &&
56 test "I" = "$(cat file6)" &&
57 test "file7" = "$(cat file7)"
60 # A - B - C - D - E
61 # \ \ \
62 # F - G - H -- L2 \ --> L2
63 # \ | \
64 # I -- G3 --- J2 -- K2 I -- G3 -- K2
65 # G2 = different changes as G
66 test_expect_success 'keep different-resolution merges with -p' '
67 git checkout H &&
68 test_must_fail git merge E &&
69 test_commit L2 file1 23 &&
70 git checkout I &&
71 test_commit G3 file1 4 &&
72 test_must_fail git merge E &&
73 test_commit J2 file1 24 &&
74 test_commit K2 file7 file7 &&
75 test_must_fail git rebase -i -p L2 &&
76 echo 234 > file1 &&
77 git add file1 &&
78 git rebase --continue &&
79 test $(git rev-parse HEAD^^^) = $(git rev-parse L2) &&
80 test "234" = "$(cat file1)" &&
81 test "I" = "$(cat file6)" &&
82 test "file7" = "$(cat file7)"
85 test_done