]>
Commit | Line | Data |
---|---|---|
b91db270 YD |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2006 Yann Dirson, based on t3400 by Amos Waterland | |
4 | # | |
5 | ||
5be60078 | 6 | test_description='git cherry should detect patches integrated upstream |
b91db270 YD |
7 | |
8 | This test cherry-picks one local change of two into master branch, and | |
5be60078 | 9 | checks that git cherry only returns the second patch in the local branch |
b91db270 YD |
10 | ' |
11 | . ./test-lib.sh | |
12 | ||
0e46e704 BD |
13 | GIT_AUTHOR_EMAIL=bogus_email_address |
14 | export GIT_AUTHOR_EMAIL | |
b91db270 YD |
15 | |
16 | test_expect_success \ | |
17 | 'prepare repository with topic branch, and check cherry finds the 2 patches from there' \ | |
18 | 'echo First > A && | |
5be60078 | 19 | git update-index --add A && |
0cb0e143 | 20 | git commit -m "Add A." && |
b91db270 | 21 | |
0cb0e143 | 22 | git checkout -b my-topic-branch && |
b91db270 YD |
23 | |
24 | echo Second > B && | |
5be60078 | 25 | git update-index --add B && |
0cb0e143 | 26 | git commit -m "Add B." && |
b91db270 YD |
27 | |
28 | sleep 2 && | |
29 | echo AnotherSecond > C && | |
5be60078 | 30 | git update-index --add C && |
0cb0e143 | 31 | git commit -m "Add C." && |
b91db270 | 32 | |
0cb0e143 | 33 | git checkout -f master && |
fcc387db | 34 | rm -f B C && |
b91db270 YD |
35 | |
36 | echo Third >> A && | |
5be60078 | 37 | git update-index A && |
0cb0e143 | 38 | git commit -m "Modify A." && |
b91db270 | 39 | |
5be60078 | 40 | expr "$(echo $(git cherry master my-topic-branch) )" : "+ [^ ]* + .*" |
b91db270 YD |
41 | ' |
42 | ||
43 | test_expect_success \ | |
44 | 'check that cherry with limit returns only the top patch'\ | |
5be60078 | 45 | 'expr "$(echo $(git cherry master my-topic-branch my-topic-branch^1) )" : "+ [^ ]*" |
b91db270 YD |
46 | ' |
47 | ||
48 | test_expect_success \ | |
49 | 'cherry-pick one of the 2 patches, and check cherry recognized one and only one as new' \ | |
5be60078 JH |
50 | 'git cherry-pick my-topic-branch^0 && |
51 | echo $(git cherry master my-topic-branch) && | |
52 | expr "$(echo $(git cherry master my-topic-branch) )" : "+ [^ ]* - .*" | |
b91db270 YD |
53 | ' |
54 | ||
55 | test_done |