3 # Copyright (c) 2005 Amos Waterland
6 test_description='git rebase should not destroy author information
8 This test runs git rebase and checks that the author information is not lost.
12 GIT_AUTHOR_EMAIL=bogus_email_address
13 export GIT_AUTHOR_EMAIL
16 'prepare repository with topic branches' \
18 git update-index --add A &&
19 git-commit -m "Add A." &&
20 git checkout -b my-topic-branch &&
22 git update-index --add B &&
23 git-commit -m "Add B." &&
24 git checkout -f master &&
27 git-commit -m "Modify A." &&
28 git checkout -b side my-topic-branch &&
31 git commit -m "Add C" &&
32 git checkout -b nonlinear my-topic-branch &&
35 git commit -m "Modify B" &&
37 git checkout -b upstream-merged-nonlinear &&
39 git checkout -f my-topic-branch &&
43 test_expect_success 'rebase against master' '
47 'the rebase operation should not have destroyed author information' \
48 '! (git log | grep "Author:" | grep "<>")'
50 test_expect_success 'rebase after merge master' '
51 git reset --hard topic &&
54 ! (git show | grep "^Merge:")
57 test_expect_success 'rebase of history with merges is linearized' '
58 git checkout nonlinear &&
59 test 4 = $(git rev-list master.. | wc -l) &&
61 test 3 = $(git rev-list master.. | wc -l)
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) &&
69 test 3 = $(git rev-list master.. | wc -l)
72 test_expect_success 'rebase a single mode change' '
73 git checkout master &&
77 git commit -m prepare &&
78 git checkout -b modechange HEAD^ &&
83 git commit -m modechange A X &&
84 GIT_TRACE=1 git rebase master