Documentation: clarify commits affected by gitk --merge
[git/git.git] / t / t3400-rebase.sh
CommitLineData
294c695d
AW
1#!/bin/sh
2#
3# Copyright (c) 2005 Amos Waterland
4#
5
6test_description='git rebase should not destroy author information
7
8This test runs git rebase and checks that the author information is not lost.
9'
10. ./test-lib.sh
11
0e46e704
BD
12GIT_AUTHOR_EMAIL=bogus_email_address
13export GIT_AUTHOR_EMAIL
294c695d
AW
14
15test_expect_success \
1308c17b 16 'prepare repository with topic branches' \
294c695d 17 'echo First > A &&
5be60078 18 git update-index --add A &&
0cb0e143 19 git commit -m "Add A." &&
294c695d
AW
20 git checkout -b my-topic-branch &&
21 echo Second > B &&
5be60078 22 git update-index --add B &&
0cb0e143 23 git commit -m "Add B." &&
294c695d
AW
24 git checkout -f master &&
25 echo Third >> A &&
5be60078 26 git update-index A &&
0cb0e143 27 git commit -m "Modify A." &&
1308c17b
JS
28 git checkout -b side my-topic-branch &&
29 echo Side >> C &&
30 git add C &&
31 git commit -m "Add C" &&
32 git checkout -b nonlinear my-topic-branch &&
33 echo Edit >> B &&
34 git add B &&
35 git commit -m "Modify B" &&
36 git merge side &&
37 git checkout -b upstream-merged-nonlinear &&
38 git merge master &&
294c695d 39 git checkout -f my-topic-branch &&
1308c17b
JS
40 git tag topic
41'
42
43test_expect_success 'rebase against master' '
294c695d
AW
44 git rebase master'
45
41ac414e 46test_expect_success \
294c695d 47 'the rebase operation should not have destroyed author information' \
bbf08124 48 '! (git log | grep "Author:" | grep "<>")'
294c695d 49
1308c17b
JS
50test_expect_success 'rebase after merge master' '
51 git reset --hard topic &&
52 git merge master &&
53 git rebase master &&
bbf08124 54 ! (git show | grep "^Merge:")
1308c17b
JS
55'
56
57test_expect_success 'rebase of history with merges is linearized' '
58 git checkout nonlinear &&
59 test 4 = $(git rev-list master.. | wc -l) &&
60 git rebase master &&
61 test 3 = $(git rev-list master.. | wc -l)
62'
63
64test_expect_success \
65 'rebase of history with merges after upstream merge is linearized' '
66 git checkout upstream-merged-nonlinear &&
67 test 5 = $(git rev-list master.. | wc -l) &&
68 git rebase master &&
69 test 3 = $(git rev-list master.. | wc -l)
70'
71
ece7b749
JS
72test_expect_success 'rebase a single mode change' '
73 git checkout master &&
74 echo 1 > X &&
75 git add X &&
76 test_tick &&
77 git commit -m prepare &&
78 git checkout -b modechange HEAD^ &&
79 echo 1 > X &&
80 git add X &&
81 chmod a+x A &&
82 test_tick &&
83 git commit -m modechange A X &&
84 GIT_TRACE=1 git rebase master
85'
86
294c695d 87test_done