interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / t / t3425-rebase-topology-merges.sh

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