Add new fast-export testcases

The testcases test the new --tag-of-filtered-object option, the output
when limiting what to export by path, and test behavior when no
exact-ref revision is included (e.g. master~8 present on command line
but not master).

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Elijah Newren 2009-06-25 22:48:32 -06:00 committed by Junio C Hamano
parent 2d8ad46919
commit 25e0ca5dd6

View file

@ -262,6 +262,94 @@ test_expect_success 'cope with tagger-less tags' '
'
test_expect_success 'setup for limiting exports by PATH' '
mkdir limit-by-paths &&
cd limit-by-paths &&
git init &&
echo hi > there &&
git add there &&
git commit -m "First file" &&
echo foo > bar &&
git add bar &&
git commit -m "Second file" &&
git tag -a -m msg mytag &&
echo morefoo >> bar &&
git add bar &&
git commit -m "Change to second file" &&
cd ..
'
cat > limit-by-paths/expected << EOF
blob
mark :1
data 3
hi
reset refs/tags/mytag
commit refs/tags/mytag
mark :2
author A U Thor <author@example.com> 1112912713 -0700
committer C O Mitter <committer@example.com> 1112912713 -0700
data 11
First file
M 100644 :1 there
EOF
test_expect_success 'dropping tag of filtered out object' '
cd limit-by-paths &&
git fast-export --tag-of-filtered-object=drop mytag -- there > output &&
test_cmp output expected &&
cd ..
'
cat >> limit-by-paths/expected << EOF
tag mytag
from :2
tagger C O Mitter <committer@example.com> 1112912713 -0700
data 4
msg
EOF
test_expect_success 'rewriting tag of filtered out object' '
cd limit-by-paths &&
git fast-export --tag-of-filtered-object=rewrite mytag -- there > output &&
test_cmp output expected &&
cd ..
'
cat > limit-by-paths/expected << EOF
blob
mark :1
data 4
foo
blob
mark :2
data 3
hi
reset refs/heads/master
commit refs/heads/master
mark :3
author A U Thor <author@example.com> 1112912713 -0700
committer C O Mitter <committer@example.com> 1112912713 -0700
data 12
Second file
M 100644 :1 bar
M 100644 :2 there
EOF
test_expect_failure 'no exact-ref revisions included' '
cd limit-by-paths &&
git fast-export master~2..master~1 > output &&
test_cmp output expected &&
cd ..
'
test_expect_success 'set-up a few more tags for tag export tests' '
git checkout -f master &&
HEAD_TREE=`git show -s --pretty=raw HEAD | grep tree | sed "s/tree //"` &&