Skip to content

Commit 3f21398

Browse files
martinvonzgitster
authored andcommitted
add tests for rebasing merged history
Signed-off-by: Martin von Zweigbergk <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6a6bc5b commit 3f21398

File tree

5 files changed

+260
-137
lines changed

5 files changed

+260
-137
lines changed

t/t3400-rebase.sh

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ test_expect_success 'prepare repository with topic branches' '
4040
echo Side >>C &&
4141
git add C &&
4242
git commit -m "Add C" &&
43-
git checkout -b nonlinear my-topic-branch &&
44-
echo Edit >>B &&
45-
git add B &&
46-
git commit -m "Modify B" &&
47-
git merge side &&
48-
git checkout -b upstream-merged-nonlinear &&
49-
git merge master &&
5043
git checkout -f my-topic-branch &&
5144
git tag topic
5245
'
@@ -106,31 +99,9 @@ test_expect_success 'rebase from ambiguous branch name' '
10699
git rebase master
107100
'
108101

109-
test_expect_success 'rebase after merge master' '
110-
git checkout --detach refs/tags/topic &&
111-
git branch -D topic &&
112-
git reset --hard topic &&
113-
git merge master &&
114-
git rebase master &&
115-
! (git show | grep "^Merge:")
116-
'
117-
118-
test_expect_success 'rebase of history with merges is linearized' '
119-
git checkout nonlinear &&
120-
test 4 = $(git rev-list master.. | wc -l) &&
121-
git rebase master &&
122-
test 3 = $(git rev-list master.. | wc -l)
123-
'
124-
125-
test_expect_success 'rebase of history with merges after upstream merge is linearized' '
126-
git checkout upstream-merged-nonlinear &&
127-
test 5 = $(git rev-list master.. | wc -l) &&
128-
git rebase master &&
129-
test 3 = $(git rev-list master.. | wc -l)
130-
'
131-
132102
test_expect_success 'rebase a single mode change' '
133103
git checkout master &&
104+
git branch -D topic &&
134105
echo 1 >X &&
135106
git add X &&
136107
test_tick &&

t/t3401-rebase-partial.sh

Lines changed: 0 additions & 45 deletions
This file was deleted.

t/t3404-rebase-interactive.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -477,19 +477,11 @@ test_expect_success 'interrupted squash works as expected (case 2)' '
477477
test $one = $(git rev-parse HEAD~2)
478478
'
479479

480-
test_expect_success 'ignore patch if in upstream' '
481-
HEAD=$(git rev-parse HEAD) &&
482-
git checkout -b has-cherry-picked HEAD^ &&
480+
test_expect_success '--continue tries to commit, even for "edit"' '
483481
echo unrelated > file7 &&
484482
git add file7 &&
485483
test_tick &&
486484
git commit -m "unrelated change" &&
487-
git cherry-pick $HEAD &&
488-
EXPECT_COUNT=1 git rebase -i $HEAD &&
489-
test $HEAD = $(git rev-parse HEAD^)
490-
'
491-
492-
test_expect_success '--continue tries to commit, even for "edit"' '
493485
parent=$(git rev-parse HEAD^) &&
494486
test_tick &&
495487
FAKE_LINES="edit 1" git rebase -i HEAD^ &&

t/t3409-rebase-preserve-merges.sh

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@ Run "git rebase -p" and check that merges are properly carried along
1111
GIT_AUTHOR_EMAIL=bogus_email_address
1212
export GIT_AUTHOR_EMAIL
1313

14-
# Clone 1 (trivial merge):
15-
#
16-
# A1--A2 <-- origin/master
17-
# \ \
18-
# B1--M <-- topic
19-
# \
20-
# B2 <-- origin/topic
21-
#
2214
# Clone 2 (conflicting merge):
2315
#
2416
# A1--A2--B3 <-- origin/master
@@ -36,16 +28,6 @@ export GIT_AUTHOR_EMAIL
3628
# \--A3 <-- topic2
3729
# \
3830
# B2 <-- origin/topic
39-
#
40-
# Clone 4 (merge using second parent as base):
41-
#
42-
# A1--A2--B3 <-- origin/master
43-
# \
44-
# B1--A3--M <-- topic
45-
# \ /
46-
# \--A4 <-- topic2
47-
# \
48-
# B2 <-- origin/topic
4931

5032
test_expect_success 'setup for merge-preserving rebase' \
5133
'echo First > A &&
@@ -58,20 +40,6 @@ test_expect_success 'setup for merge-preserving rebase' \
5840
git checkout -f master &&
5941
echo Third >> A &&
6042
git commit -a -m "Modify A2" &&
61-
62-
git clone ./. clone1 &&
63-
(cd clone1 &&
64-
git checkout -b topic origin/topic &&
65-
git merge origin/master
66-
) &&
67-
68-
git clone ./. clone4 &&
69-
(
70-
cd clone4 &&
71-
git checkout -b topic origin/topic &&
72-
git merge origin/master
73-
) &&
74-
7543
echo Fifth > B &&
7644
git add B &&
7745
git commit -m "Add different B" &&
@@ -101,16 +69,6 @@ test_expect_success 'setup for merge-preserving rebase' \
10169
git commit -a -m "Modify B2"
10270
'
10371

104-
test_expect_success 'rebase -p fakes interactive rebase' '
105-
(
106-
cd clone1 &&
107-
git fetch &&
108-
git rebase -p origin/topic &&
109-
test 1 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) &&
110-
test 1 = $(git rev-list --all --pretty=oneline | grep "Merge remote-tracking branch " | wc -l)
111-
)
112-
'
113-
11472
test_expect_success '--continue works after a conflict' '
11573
(
11674
cd clone2 &&
@@ -138,15 +96,4 @@ test_expect_success 'rebase -p preserves no-ff merges' '
13896
)
13997
'
14098

141-
test_expect_success 'rebase -p works when base inside second parent' '
142-
(
143-
cd clone4 &&
144-
git fetch &&
145-
git rebase -p HEAD^2 &&
146-
test 1 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) &&
147-
test 1 = $(git rev-list --all --pretty=oneline | grep "Modify B" | wc -l) &&
148-
test 1 = $(git rev-list --all --pretty=oneline | grep "Merge remote-tracking branch " | wc -l)
149-
)
150-
'
151-
15299
test_done

0 commit comments

Comments
 (0)