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