|
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +test_description='tests remote-svn' |
| 4 | + |
| 5 | +. ./test-lib.sh |
| 6 | + |
| 7 | +MARKSPATH=.git/info/fast-import/remote-svn |
| 8 | + |
| 9 | +if ! test_have_prereq PYTHON |
| 10 | +then |
| 11 | + skip_all='skipping remote-svn tests, python not available' |
| 12 | + test_done |
| 13 | +fi |
| 14 | + |
| 15 | +# We override svnrdump by placing a symlink to the svnrdump-emulator in . |
| 16 | +export PATH="$HOME:$PATH" |
| 17 | +ln -sf $GIT_BUILD_DIR/contrib/svn-fe/svnrdump_sim.py "$HOME/svnrdump" |
| 18 | + |
| 19 | +init_git () { |
| 20 | + rm -fr .git && |
| 21 | + git init && |
| 22 | + #git remote add svnsim testsvn::sim:///$TEST_DIRECTORY/t9020/example.svnrdump |
| 23 | + # let's reuse an exisiting dump file!? |
| 24 | + git remote add svnsim testsvn::sim://$TEST_DIRECTORY/t9154/svn.dump |
| 25 | + git remote add svnfile testsvn::file://$TEST_DIRECTORY/t9154/svn.dump |
| 26 | +} |
| 27 | + |
| 28 | +if test -e "$GIT_BUILD_DIR/git-remote-testsvn" |
| 29 | +then |
| 30 | + test_set_prereq REMOTE_SVN |
| 31 | +fi |
| 32 | + |
| 33 | +test_debug ' |
| 34 | + git --version |
| 35 | + which git |
| 36 | + which svnrdump |
| 37 | +' |
| 38 | + |
| 39 | +test_expect_success REMOTE_SVN 'simple fetch' ' |
| 40 | + init_git && |
| 41 | + git fetch svnsim && |
| 42 | + test_cmp .git/refs/svn/svnsim/master .git/refs/remotes/svnsim/master && |
| 43 | + cp .git/refs/remotes/svnsim/master master.good |
| 44 | +' |
| 45 | + |
| 46 | +test_debug ' |
| 47 | + cat .git/refs/svn/svnsim/master |
| 48 | + cat .git/refs/remotes/svnsim/master |
| 49 | +' |
| 50 | + |
| 51 | +test_expect_success REMOTE_SVN 'repeated fetch, nothing shall change' ' |
| 52 | + git fetch svnsim && |
| 53 | + test_cmp master.good .git/refs/remotes/svnsim/master |
| 54 | +' |
| 55 | + |
| 56 | +test_expect_success REMOTE_SVN 'fetch from a file:// url gives the same result' ' |
| 57 | + git fetch svnfile |
| 58 | +' |
| 59 | + |
| 60 | +test_expect_failure REMOTE_SVN 'the sha1 differ because the git-svn-id line in the commit msg contains the url' ' |
| 61 | + test_cmp .git/refs/remotes/svnfile/master .git/refs/remotes/svnsim/master |
| 62 | +' |
| 63 | + |
| 64 | +test_expect_success REMOTE_SVN 'mark-file regeneration' ' |
| 65 | + # filter out any other marks, that can not be regenerated. Only up to 3 digit revisions are allowed here |
| 66 | + grep ":[0-9]\{1,3\} " $MARKSPATH/svnsim.marks > $MARKSPATH/svnsim.marks.old && |
| 67 | + rm $MARKSPATH/svnsim.marks && |
| 68 | + git fetch svnsim && |
| 69 | + test_cmp $MARKSPATH/svnsim.marks.old $MARKSPATH/svnsim.marks |
| 70 | +' |
| 71 | + |
| 72 | +test_expect_success REMOTE_SVN 'incremental imports must lead to the same head' ' |
| 73 | + export SVNRMAX=3 && |
| 74 | + init_git && |
| 75 | + git fetch svnsim && |
| 76 | + test_cmp .git/refs/svn/svnsim/master .git/refs/remotes/svnsim/master && |
| 77 | + unset SVNRMAX && |
| 78 | + git fetch svnsim && |
| 79 | + test_cmp master.good .git/refs/remotes/svnsim/master |
| 80 | +' |
| 81 | + |
| 82 | +test_debug 'git branch -a' |
| 83 | + |
| 84 | +test_done |
0 commit comments