Merge branch 'maint'
[git/kirr.git] / t / t3416-rebase-onto-threedots.sh
blobddf2f648538319df0319c6826f1a64321b3afdb2
1 #!/bin/sh
3 test_description='git rebase --onto A...B'
5 . ./test-lib.sh
6 . "$TEST_DIRECTORY/lib-rebase.sh"
8 # Rebase only the tip commit of "topic" on merge base between "master"
9 # and "topic". Cannot do this for "side" with "master" because there
10 # is no single merge base.
13 # F---G topic G'
14 # / /
15 # A---B---C---D---E master --> A---B---C---D---E
16 # \ \ /
17 # \ x
18 # \ / \
19 # H---I---J---K side
21 test_expect_success setup '
22 test_commit A &&
23 test_commit B &&
24 git branch side &&
25 test_commit C &&
26 git branch topic &&
27 git checkout side &&
28 test_commit H &&
29 git checkout master &&
30 test_tick &&
31 git merge H &&
32 git tag D &&
33 test_commit E &&
34 git checkout topic &&
35 test_commit F &&
36 test_commit G &&
37 git checkout side &&
38 test_tick &&
39 git merge C &&
40 git tag I &&
41 test_commit J &&
42 test_commit K
45 test_expect_success 'rebase --onto master...topic' '
46 git reset --hard &&
47 git checkout topic &&
48 git reset --hard G &&
50 git rebase --onto master...topic F &&
51 git rev-parse HEAD^1 >actual &&
52 git rev-parse C^0 >expect &&
53 test_cmp expect actual
56 test_expect_success 'rebase --onto master...' '
57 git reset --hard &&
58 git checkout topic &&
59 git reset --hard G &&
61 git rebase --onto master... F &&
62 git rev-parse HEAD^1 >actual &&
63 git rev-parse C^0 >expect &&
64 test_cmp expect actual
67 test_expect_success 'rebase --onto master...side' '
68 git reset --hard &&
69 git checkout side &&
70 git reset --hard K &&
72 test_must_fail git rebase --onto master...side J
75 test_expect_success 'rebase -i --onto master...topic' '
76 git reset --hard &&
77 git checkout topic &&
78 git reset --hard G &&
79 set_fake_editor &&
80 EXPECT_COUNT=1 git rebase -i --onto master...topic F &&
81 git rev-parse HEAD^1 >actual &&
82 git rev-parse C^0 >expect &&
83 test_cmp expect actual
86 test_expect_success 'rebase -i --onto master...' '
87 git reset --hard &&
88 git checkout topic &&
89 git reset --hard G &&
90 set_fake_editor &&
91 EXPECT_COUNT=1 git rebase -i --onto master... F &&
92 git rev-parse HEAD^1 >actual &&
93 git rev-parse C^0 >expect &&
94 test_cmp expect actual
97 test_expect_success 'rebase -i --onto master...side' '
98 git reset --hard &&
99 git checkout side &&
100 git reset --hard K &&
102 test_must_fail git rebase -i --onto master...side J
105 test_done