]> git.ipfire.org Git - thirdparty/git.git/blame - t/t3410-rebase-preserve-dropped-merges.sh
perl: bump the required Perl version to 5.8 from 5.6.[21]
[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
14# set up two branches like this:
15#
16# A - B - C - D - E
17# \
18# F - G - H
19# \
20# I
21#
22# where B, D and G touch the same file.
23
24test_expect_success 'setup' '
4bd03d15
JS
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
faae853c
SH
36'
37
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
44test_expect_success 'skip same-resolution merges with -p' '
4bd03d15 45 git checkout H &&
ce14e0b2 46 test_must_fail git merge E &&
4bd03d15
JS
47 test_commit L file1 23 &&
48 git checkout I &&
49 test_commit G2 file1 3 &&
ce14e0b2 50 test_must_fail git merge E &&
4bd03d15
JS
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) &&
faae853c 55 test "23" = "$(cat file1)" &&
4bd03d15
JS
56 test "I" = "$(cat file6)" &&
57 test "file7" = "$(cat file7)"
faae853c
SH
58'
59
60# A - B - C - D - E
61# \ \ \
4bd03d15
JS
62# F - G - H -- L2 \ --> L2
63# \ | \
64# I -- G3 --- J2 -- K2 I -- G3 -- K2
faae853c
SH
65# G2 = different changes as G
66test_expect_success 'keep different-resolution merges with -p' '
4bd03d15 67 git checkout H &&
ce14e0b2 68 test_must_fail git merge E &&
4bd03d15
JS
69 test_commit L2 file1 23 &&
70 git checkout I &&
71 test_commit G3 file1 4 &&
ce14e0b2 72 test_must_fail git merge E &&
4bd03d15
JS
73 test_commit J2 file1 24 &&
74 test_commit K2 file7 file7 &&
75 test_must_fail git rebase -i -p L2 &&
faae853c
SH
76 echo 234 > file1 &&
77 git add file1 &&
4bd03d15
JS
78 git rebase --continue &&
79 test $(git rev-parse HEAD^^^) = $(git rev-parse L2) &&
faae853c 80 test "234" = "$(cat file1)" &&
4bd03d15
JS
81 test "I" = "$(cat file6)" &&
82 test "file7" = "$(cat file7)"
faae853c
SH
83'
84
85test_done