Git 1.7.0.7
[git/mingw/4msysgit/kblees.git] / t / t3500-cherry.sh
blobdadbbc2a9f9b70a4e33f5aa825b8f9fe14eec124
1 #!/bin/sh
3 # Copyright (c) 2006 Yann Dirson, based on t3400 by Amos Waterland
6 test_description='git cherry should detect patches integrated upstream
8 This test cherry-picks one local change of two into master branch, and
9 checks that git cherry only returns the second patch in the local branch
11 . ./test-lib.sh
13 GIT_AUTHOR_EMAIL=bogus_email_address
14 export GIT_AUTHOR_EMAIL
16 test_expect_success \
17 'prepare repository with topic branch, and check cherry finds the 2 patches from there' \
18 'echo First > A &&
19 git update-index --add A &&
20 git commit -m "Add A." &&
22 git checkout -b my-topic-branch &&
24 echo Second > B &&
25 git update-index --add B &&
26 git commit -m "Add B." &&
28 sleep 2 &&
29 echo AnotherSecond > C &&
30 git update-index --add C &&
31 git commit -m "Add C." &&
33 git checkout -f master &&
34 rm -f B C &&
36 echo Third >> A &&
37 git update-index A &&
38 git commit -m "Modify A." &&
40 expr "$(echo $(git cherry master my-topic-branch) )" : "+ [^ ]* + .*"
43 test_expect_success \
44 'check that cherry with limit returns only the top patch'\
45 'expr "$(echo $(git cherry master my-topic-branch my-topic-branch^1) )" : "+ [^ ]*"
48 test_expect_success \
49 'cherry-pick one of the 2 patches, and check cherry recognized one and only one as new' \
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) )" : "+ [^ ]* - .*"
55 test_done