Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/lib-git-svn.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / lib-git-svn.sh` 144 lines ยท 3213 bytes Raw Blame History 1 . ./test-lib.sh 2 3 if test -n "$NO_SVN_TESTS" 4 then 5 skip_all='skipping git svn tests, NO_SVN_TESTS defined' 6 test_done 7 fi 8 if ! test_have_prereq PERL; then 9 skip_all='skipping git svn tests, perl not available' 10 test_done 11 fi 12 13 GIT_DIR=$PWD/.git 14 GIT_SVN_DIR=$GIT_DIR/svn/refs/remotes/git-svn 15 SVN_TREE=$GIT_SVN_DIR/svn-tree 16 test_set_port SVNSERVE_PORT 17 18 if ! svn help >/dev/null 2>&1 19 then 20 skip_all='skipping git svn tests, svn not found' 21 test_done 22 fi 23 24 svnrepo=$PWD/svnrepo 25 export svnrepo 26 svnconf=$PWD/svnconf 27 export svnconf 28 29 x=0 30 perl -w -e " 31 use SVN::Core; 32 use SVN::Repos; 33 \$SVN::Core::VERSION gt '1.1.0' or exit(42); 34 system(qw/svnadmin create --fs-type fsfs/, \$ENV{svnrepo}) == 0 or exit(41); 35 " >&3 2>&4 || x=$? 36 if test $x -ne 0 37 then 38 if test $x -eq 42; then 39 skip_all='Perl SVN libraries must be >= 1.1.0' 40 elif test $x -eq 41; then 41 skip_all='svnadmin failed to create fsfs repository' 42 else 43 skip_all='Perl SVN libraries not found or unusable' 44 fi 45 test_done 46 fi 47 48 rawsvnrepo="$svnrepo" 49 svnrepo="file://$svnrepo" 50 51 poke() { 52 test-tool chmtime +1 "$1" 53 } 54 55 # We need this, because we should pass empty configuration directory to 56 # the 'svn commit' to avoid automated property changes and other stuff 57 # that could be set from user's configuration files in ~/.subversion. 58 svn_cmd () { 59 [ -d "$svnconf" ] || mkdir "$svnconf" 60 orig_svncmd="$1"; shift 61 if [ -z "$orig_svncmd" ]; then 62 svn 63 return 64 fi 65 svn "$orig_svncmd" --config-dir "$svnconf" "$@" 66 } 67 68 maybe_start_httpd () { 69 loc=${1-svn} 70 71 if test_bool_env GIT_TEST_SVN_HTTPD false 72 then 73 . "$TEST_DIRECTORY"/lib-httpd.sh 74 LIB_HTTPD_SVN="$loc" 75 start_httpd 76 fi 77 } 78 79 convert_to_rev_db () { 80 perl -w -- - "$(test_oid rawsz)" "$@" <<\EOF 81 use strict; 82 my $oidlen = shift; 83 @ARGV == 2 or die "usage: convert_to_rev_db "; 84 my $record_size = $oidlen + 4; 85 my $hexlen = $oidlen * 2; 86 open my $wr, '+>', $ARGV[1] or die "$!: couldn't open: $ARGV[1]"; 87 open my $rd, '<', $ARGV[0] or die "$!: couldn't open: $ARGV[0]"; 88 my $size = (stat($rd))[7]; 89 ($size % $record_size) == 0 or die "Inconsistent size: $size"; 90 while (sysread($rd, my $buf, $record_size) == $record_size) { 91 my ($r, $c) = unpack("NH$hexlen", $buf); 92 my $offset = $r * ($hexlen + 1); 93 seek $wr, 0, 2 or die $!; 94 my $pos = tell $wr; 95 if ($pos < $offset) { 96 for (1 .. (($offset - $pos) / ($hexlen + 1))) { 97 print $wr (('0' x $hexlen),"\n") or die $!; 98 } 99 } 100 seek $wr, $offset, 0 or die $!; 101 print $wr $c,"\n" or die $!; 102 } 103 close $wr or die $!; 104 close $rd or die $!; 105 EOF 106 } 107 108 require_svnserve () { 109 if ! test_bool_env GIT_TEST_SVNSERVE false 110 then 111 skip_all='skipping svnserve test. (set $GIT_TEST_SVNSERVE to enable)' 112 test_done 113 fi 114 } 115 116 start_svnserve () { 117 svnserve --listen-port $SVNSERVE_PORT \ 118 --root "$rawsvnrepo" \ 119 --listen-once \ 120 --listen-host 127.0.0.1 & 121 } 122 123 prepare_utf8_locale () { 124 if test -z "$GIT_TEST_UTF8_LOCALE" 125 then 126 case "${LC_ALL:-$LANG}" in 127 *.[Uu][Tt][Ff]8 | *.[Uu][Tt][Ff]-8) 128 GIT_TEST_UTF8_LOCALE="${LC_ALL:-$LANG}" 129 ;; 130 *) 131 GIT_TEST_UTF8_LOCALE=$(locale -a | sed -n '/\.[uU][tT][fF]-*8$/{ 132 p 133 q 134 }') 135 ;; 136 esac 137 fi 138 if test -n "$GIT_TEST_UTF8_LOCALE" 139 then 140 test_set_prereq UTF8 141 else 142 say "# UTF-8 locale not available, some tests are skipped" 143 fi 144 }