Skip to content

Commit

Permalink
Add new fast-export testcases
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Elijah Newren authored and Junio C Hamano committed Jun 27, 2009
1 parent 2d8ad46 commit 25e0ca5
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions t/t9301-fast-export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 //"` &&
Expand Down

0 comments on commit 25e0ca5

Please sign in to comment.