Merge branch 'kh/svn'
[git/mingw/4msysgit/wingit-dll.git] / t / t3500-cherry.sh
blobb141f89de2be4a2fa6ff1f3b0748daece23f9d8a
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 export GIT_AUTHOR_EMAIL=bogus_email_address
15 test_expect_success \
16 'prepare repository with topic branch, and check cherry finds the 2 patches from there' \
17 'echo First > A &&
18 git-update-index --add A &&
19 git-commit -m "Add A." &&
21 git-checkout -b my-topic-branch &&
23 echo Second > B &&
24 git-update-index --add B &&
25 git-commit -m "Add B." &&
27 sleep 2 &&
28 echo AnotherSecond > C &&
29 git-update-index --add C &&
30 git-commit -m "Add C." &&
32 git-checkout -f master &&
34 echo Third >> A &&
35 git-update-index A &&
36 git-commit -m "Modify A." &&
38 expr "$(echo $(git-cherry master my-topic-branch) )" : "+ [^ ]* + .*"
41 test_expect_success \
42 'check that cherry with limit returns only the top patch'\
43 'expr "$(echo $(git-cherry master my-topic-branch my-topic-branch^1) )" : "+ [^ ]*"
46 test_expect_success \
47 'cherry-pick one of the 2 patches, and check cherry recognized one and only one as new' \
48 'git-cherry-pick my-topic-branch^0 &&
49 echo $(git-cherry master my-topic-branch) &&
50 expr "$(echo $(git-cherry master my-topic-branch) )" : "+ [^ ]* - .*"
53 test_done