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