Merge branch 'maint'
[git] / t / t9010-svn-fe.sh
1 #!/bin/sh
2
3 test_description='check svn dumpfile importer'
4
5 . ./test-lib.sh
6
7 if ! svnadmin -h >/dev/null 2>&1
8 then
9         skip_all='skipping svn-fe tests, svn not available'
10         test_done
11 fi
12
13 svnconf=$PWD/svnconf
14 export svnconf
15
16 svn_cmd () {
17         subcommand=$1 &&
18         shift &&
19         mkdir -p "$svnconf" &&
20         svn "$subcommand" --config-dir "$svnconf" "$@"
21 }
22
23 reinit_git () {
24         rm -fr .git &&
25         git init
26 }
27
28 >empty
29
30 test_expect_success 'empty dump' '
31         reinit_git &&
32         echo "SVN-fs-dump-format-version: 2" >input &&
33         test-svn-fe input >stream &&
34         git fast-import <stream
35 '
36
37 test_expect_success 'v3 dumps not supported' '
38         reinit_git &&
39         echo "SVN-fs-dump-format-version: 3" >input &&
40         test_must_fail test-svn-fe input >stream &&
41         test_cmp empty stream
42 '
43
44 test_expect_success 't9135/svn.dump' '
45         svnadmin create simple-svn &&
46         svnadmin load simple-svn <"$TEST_DIRECTORY/t9135/svn.dump" &&
47         svn_cmd export "file://$PWD/simple-svn" simple-svnco &&
48         git init simple-git &&
49         test-svn-fe "$TEST_DIRECTORY/t9135/svn.dump" >simple.fe &&
50         (
51                 cd simple-git &&
52                 git fast-import <../simple.fe
53         ) &&
54         (
55                 cd simple-svnco &&
56                 git init &&
57                 git add . &&
58                 git fetch ../simple-git master &&
59                 git diff --exit-code FETCH_HEAD
60         )
61 '
62
63 test_done