]> git.ipfire.org Git - thirdparty/git.git/blame - t/t3410-rebase-preserve-dropped-merges.sh
Merge branch 'tb/use-common-win32-pathfuncs-on-cygwin'
[thirdparty/git.git] / t / t3410-rebase-preserve-dropped-merges.sh
CommitLineData
faae853c
SH
1#!/bin/sh
2#
3# Copyright (c) 2008 Stephen Haberman
4#
5
6test_description='git rebase preserve merges
7
8This test runs git rebase with preserve merges and ensures commits
9dropped by the --cherry-pick flag have their childrens parents
10rewritten.
11'
12. ./test-lib.sh
13
11aad464
JS
14if ! test_have_prereq REBASE_P; then
15 skip_all='skipping git rebase -p tests, as asked for'
16 test_done
17fi
18
faae853c
SH
19# set up two branches like this:
20#
21# A - B - C - D - E
22# \
23# F - G - H
24# \
25# I
26#
27# where B, D and G touch the same file.
28
29test_expect_success 'setup' '
4bd03d15
JS
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
faae853c
SH
41'
42
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
49test_expect_success 'skip same-resolution merges with -p' '
4bd03d15 50 git checkout H &&
ce14e0b2 51 test_must_fail git merge E &&
4bd03d15
JS
52 test_commit L file1 23 &&
53 git checkout I &&
54 test_commit G2 file1 3 &&
ce14e0b2 55 test_must_fail git merge E &&
4bd03d15
JS
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) &&
faae853c 60 test "23" = "$(cat file1)" &&
4bd03d15
JS
61 test "I" = "$(cat file6)" &&
62 test "file7" = "$(cat file7)"
faae853c
SH
63'
64
65# A - B - C - D - E
66# \ \ \
4bd03d15
JS
67# F - G - H -- L2 \ --> L2
68# \ | \
69# I -- G3 --- J2 -- K2 I -- G3 -- K2
faae853c
SH
70# G2 = different changes as G
71test_expect_success 'keep different-resolution merges with -p' '
4bd03d15 72 git checkout H &&
ce14e0b2 73 test_must_fail git merge E &&
4bd03d15
JS
74 test_commit L2 file1 23 &&
75 git checkout I &&
76 test_commit G3 file1 4 &&
ce14e0b2 77 test_must_fail git merge E &&
4bd03d15
JS
78 test_commit J2 file1 24 &&
79 test_commit K2 file7 file7 &&
80 test_must_fail git rebase -i -p L2 &&
faae853c
SH
81 echo 234 > file1 &&
82 git add file1 &&
4bd03d15
JS
83 git rebase --continue &&
84 test $(git rev-parse HEAD^^^) = $(git rev-parse L2) &&
faae853c 85 test "234" = "$(cat file1)" &&
4bd03d15
JS
86 test "I" = "$(cat file6)" &&
87 test "file7" = "$(cat file7)"
faae853c
SH
88'
89
90test_done