]> git.ipfire.org Git - thirdparty/git.git/blame - t/t3425-rebase-topology-merges.sh
Merge branch 'eg/config-type-path-docfix'
[thirdparty/git.git] / t / t3425-rebase-topology-merges.sh
CommitLineData
3f213981
MZ
1#!/bin/sh
2
3test_description='rebase topology tests with merges'
9ff2f060
ÆAB
4
5TEST_PASSES_SANITIZE_LEAK=true
3f213981
MZ
6. ./test-lib.sh
7. "$TEST_DIRECTORY"/lib-rebase.sh
8
9test_revision_subjects () {
10 expected="$1"
11 shift
12 set -- $(git log --format=%s --no-walk=unsorted "$@")
13 test "$expected" = "$*"
14}
15
16# a---b-----------c
17# \ \
18# d-------e \
19# \ \ \
20# n---o---w---v
21# \
22# z
23test_expect_success 'setup of non-linear-history' '
24 test_commit a &&
25 test_commit b &&
26 test_commit c &&
27 git checkout b &&
28 test_commit d &&
99094a7a 29 test_commit e &&
3f213981
MZ
30
31 git checkout c &&
32 test_commit g &&
33 revert h g &&
34 git checkout d &&
984f78d2 35 cherry_pick gp g &&
3f213981
MZ
36 test_commit i &&
37 git checkout b &&
99094a7a 38 test_commit f &&
3f213981
MZ
39
40 git checkout d &&
41 test_commit n &&
42 test_commit o &&
43 test_merge w e &&
44 test_merge v c &&
45 git checkout o &&
46 test_commit z
47'
48
49test_run_rebase () {
50 result=$1
51 shift
52 test_expect_$result "rebase $* after merge from upstream" "
53 reset_rebase &&
54 git rebase $* e w &&
55 test_cmp_rev e HEAD~2 &&
56 test_linear_range 'n o' e..
57 "
58}
10cdb9f3 59test_run_rebase success --apply
3f213981
MZ
60test_run_rebase success -m
61test_run_rebase success -i
62
63test_run_rebase () {
64 result=$1
65 shift
66 expected=$1
67 shift
68 test_expect_$result "rebase $* of non-linear history is linearized in place" "
69 reset_rebase &&
70 git rebase $* d w &&
71 test_cmp_rev d HEAD~3 &&
72 test_linear_range "\'"$expected"\'" d..
73 "
74}
10cdb9f3 75test_run_rebase success 'n o e' --apply
c91c944a 76test_run_rebase success 'n o e' -m
3f213981
MZ
77test_run_rebase success 'n o e' -i
78
79test_run_rebase () {
80 result=$1
81 shift
82 expected=$1
83 shift
84 test_expect_$result "rebase $* of non-linear history is linearized upstream" "
85 reset_rebase &&
86 git rebase $* c w &&
87 test_cmp_rev c HEAD~4 &&
88 test_linear_range "\'"$expected"\'" c..
89 "
90}
10cdb9f3 91test_run_rebase success 'd n o e' --apply
c91c944a 92test_run_rebase success 'd n o e' -m
3f213981
MZ
93test_run_rebase success 'd n o e' -i
94
95test_run_rebase () {
96 result=$1
97 shift
98 expected=$1
99 shift
100 test_expect_$result "rebase $* of non-linear history with merges after upstream merge is linearized" "
101 reset_rebase &&
102 git rebase $* c v &&
103 test_cmp_rev c HEAD~4 &&
104 test_linear_range "\'"$expected"\'" c..
105 "
106}
10cdb9f3 107test_run_rebase success 'd n o e' --apply
c91c944a 108test_run_rebase success 'd n o e' -m
3f213981
MZ
109test_run_rebase success 'd n o e' -i
110
3f213981 111test_done