diff options
author | Michael J Gruber <git@drmicha.warpmail.net> | 2011-02-18 13:34:19 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-02-21 16:33:08 -0800 |
commit | e0b9c34f7eec9d7943bbb8a3134f24e6e4e4ed3e (patch) | |
tree | eb66799b3e7f1807b1098882814a8b11bfc5eb75 /t/t6007-rev-list-cherry-pick-file.sh | |
parent | revlist.c: introduce --left/right-only for unsymmetric picking (diff) | |
download | tgif-e0b9c34f7eec9d7943bbb8a3134f24e6e4e4ed3e.tar.xz |
t6007: Make sure we test --cherry-pick
Test 5 wants to test --cherry-pick but limits by pathspec in such a way
that there are no commits on the left side of the range.
Add a test without "--cherry-pick" which displays this, and add two
more commits and another test which tests what we're after. This also
shortens the last test.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6007-rev-list-cherry-pick-file.sh')
-rwxr-xr-x | t/t6007-rev-list-cherry-pick-file.sh | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/t/t6007-rev-list-cherry-pick-file.sh b/t/t6007-rev-list-cherry-pick-file.sh index b565638e92..64b72a3e20 100755 --- a/t/t6007-rev-list-cherry-pick-file.sh +++ b/t/t6007-rev-list-cherry-pick-file.sh @@ -4,13 +4,14 @@ test_description='test git rev-list --cherry-pick -- file' . ./test-lib.sh -# A---B +# A---B---D # \ # \ -# C +# C---E # # B changes a file foo.c, adding a line of text. C changes foo.c as # well as bar.c, but the change in foo.c was identical to change B. +# D and C change bar in the same way, E differently. test_expect_success setup ' echo Hallo > foo && @@ -25,11 +26,21 @@ test_expect_success setup ' test_tick && git commit -m "C" && git tag C && + echo Dello > bar && + git add bar && + test_tick && + git commit -m "E" && + git tag E && git checkout master && git checkout branch foo && test_tick && git commit -m "B" && - git tag B + git tag B && + echo Cello > bar && + git add bar && + test_tick && + git commit -m "D" && + git tag D ' cat >expect <<EOF @@ -53,8 +64,33 @@ test_expect_success '--cherry-pick foo comes up empty' ' test -z "$(git rev-list --left-right --cherry-pick B...C -- foo)" ' +cat >expect <<EOF +>tags/C +EOF + test_expect_success '--cherry-pick bar does not come up empty' ' - ! test -z "$(git rev-list --left-right --cherry-pick B...C -- bar)" + git rev-list --left-right --cherry-pick B...C -- bar > actual && + git name-rev --stdin --name-only --refs="*tags/*" \ + < actual > actual.named && + test_cmp actual.named expect +' + +test_expect_success 'bar does not come up empty' ' + git rev-list --left-right B...C -- bar > actual && + git name-rev --stdin --name-only --refs="*tags/*" \ + < actual > actual.named && + test_cmp actual.named expect +' + +cat >expect <<EOF +>tags/E +EOF + +test_expect_success '--cherry-pick bar does not come up empty (II)' ' + git rev-list --left-right --cherry-pick D...E -- bar > actual && + git name-rev --stdin --name-only --refs="*tags/*" \ + < actual > actual.named && + test_cmp actual.named expect ' test_expect_success '--cherry-pick with independent, but identical branches' ' @@ -75,11 +111,8 @@ cat >expect <<EOF 1 2 EOF -# Insert an extra commit to break the symmetry test_expect_success '--count --left-right' ' - git checkout branch && - test_commit D && - git rev-list --count --left-right B...D > actual && + git rev-list --count --left-right C...D > actual && test_cmp expect actual ' |