2006-01-08 01:38:15 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2006 Yann Dirson, based on t3400 by Amos Waterland
|
|
|
|
#
|
|
|
|
|
2007-07-03 07:52:14 +02:00
|
|
|
test_description='git cherry should detect patches integrated upstream
|
2006-01-08 01:38:15 +01:00
|
|
|
|
|
|
|
This test cherry-picks one local change of two into master branch, and
|
2007-07-03 07:52:14 +02:00
|
|
|
checks that git cherry only returns the second patch in the local branch
|
2006-01-08 01:38:15 +01:00
|
|
|
'
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
export GIT_AUTHOR_EMAIL=bogus_email_address
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'prepare repository with topic branch, and check cherry finds the 2 patches from there' \
|
|
|
|
'echo First > A &&
|
2007-07-03 07:52:14 +02:00
|
|
|
git update-index --add A &&
|
2006-01-08 01:38:15 +01:00
|
|
|
git-commit -m "Add A." &&
|
|
|
|
|
|
|
|
git-checkout -b my-topic-branch &&
|
|
|
|
|
|
|
|
echo Second > B &&
|
2007-07-03 07:52:14 +02:00
|
|
|
git update-index --add B &&
|
2006-01-08 01:38:15 +01:00
|
|
|
git-commit -m "Add B." &&
|
|
|
|
|
|
|
|
sleep 2 &&
|
|
|
|
echo AnotherSecond > C &&
|
2007-07-03 07:52:14 +02:00
|
|
|
git update-index --add C &&
|
2006-01-08 01:38:15 +01:00
|
|
|
git-commit -m "Add C." &&
|
|
|
|
|
|
|
|
git-checkout -f master &&
|
2006-05-17 10:17:46 +02:00
|
|
|
rm -f B C &&
|
2006-01-08 01:38:15 +01:00
|
|
|
|
|
|
|
echo Third >> A &&
|
2007-07-03 07:52:14 +02:00
|
|
|
git update-index A &&
|
2006-01-08 01:38:15 +01:00
|
|
|
git-commit -m "Modify A." &&
|
|
|
|
|
2007-07-03 07:52:14 +02:00
|
|
|
expr "$(echo $(git cherry master my-topic-branch) )" : "+ [^ ]* + .*"
|
2006-01-08 01:38:15 +01:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'check that cherry with limit returns only the top patch'\
|
2007-07-03 07:52:14 +02:00
|
|
|
'expr "$(echo $(git cherry master my-topic-branch my-topic-branch^1) )" : "+ [^ ]*"
|
2006-01-08 01:38:15 +01:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'cherry-pick one of the 2 patches, and check cherry recognized one and only one as new' \
|
2007-07-03 07:52:14 +02:00
|
|
|
'git cherry-pick my-topic-branch^0 &&
|
|
|
|
echo $(git cherry master my-topic-branch) &&
|
|
|
|
expr "$(echo $(git cherry master my-topic-branch) )" : "+ [^ ]* - .*"
|
2006-01-08 01:38:15 +01:00
|
|
|
'
|
|
|
|
|
|
|
|
test_done
|