1#!/bin/sh 2# 3# Copyright (c) 2009 Eric Wong 4 5test_description='git svn creates empty directories' 6. ./lib-git-svn.sh 7 8test_expect_success 'initialize repo'' 9 for i in a b c d d/e d/e/f "weird file name" 10 do 11 svn_cmd mkdir -m "mkdir$i" "$svnrepo"/"$i" 12 done 13' 14 15test_expect_success 'clone''git svn clone "$svnrepo" cloned' 16 17test_expect_success 'empty directories exist'' 18 ( 19 cd cloned && 20 for i in a b c d d/e d/e/f "weird file name" 21 do 22 if ! test -d "$i" 23 then 24 echo >&2 "$idoes not exist" 25 exit 1 26 fi 27 done 28 ) 29' 30 31test_expect_success 'more emptiness'' 32 svn_cmd mkdir -m "bang bang" "$svnrepo"/"! !" 33' 34 35test_expect_success 'git svn rebase creates empty directory'' 36 ( cd cloned && git svn rebase ) && 37 test -d cloned/"! !" 38' 39 40test_expect_success 'git svn mkdirs recreates empty directories'' 41 ( 42 cd cloned && 43 rm -r * && 44 git svn mkdirs && 45 for i in a b c d d/e d/e/f "weird file name" "! !" 46 do 47 if ! test -d "$i" 48 then 49 echo >&2 "$idoes not exist" 50 exit 1 51 fi 52 done 53 ) 54' 55 56test_expect_success 'git svn mkdirs -r works'' 57 ( 58 cd cloned && 59 rm -r * && 60 git svn mkdirs -r7 && 61 for i in a b c d d/e d/e/f "weird file name" 62 do 63 if ! test -d "$i" 64 then 65 echo >&2 "$idoes not exist" 66 exit 1 67 fi 68 done 69 70 if test -d "! !" 71 then 72 echo >&2 "$ishould not exist" 73 exit 1 74 fi 75 76 git svn mkdirs -r8 && 77 if ! test -d "! !" 78 then 79 echo >&2 "$inot exist" 80 exit 1 81 fi 82 ) 83' 84 85test_expect_success 'initialize trunk'' 86 for i in trunk trunk/a trunk/"weird file name" 87 do 88 svn_cmd mkdir -m "mkdir$i" "$svnrepo"/"$i" 89 done 90' 91 92test_expect_success 'clone trunk''git svn clone -s "$svnrepo" trunk' 93 94test_expect_success 'empty directories in trunk exist'' 95 ( 96 cd trunk && 97 for i in a "weird file name" 98 do 99 if ! test -d "$i" 100 then 101 echo >&2 "$idoes not exist" 102 exit 1 103 fi 104 done 105 ) 106' 107 108test_expect_success 'remove a top-level directory from svn'' 109 svn_cmd rm -m "remove d" "$svnrepo"/d 110' 111 112test_expect_success 'removed top-level directory does not exist'' 113 git svn clone "$svnrepo" removed && 114 test ! -e removed/d 115 116' 117unhandled=.git/svn/refs/remotes/git-svn/unhandled.log 118test_expect_success 'git svn gc-ed files work'' 119 ( 120 cd removed && 121 git svn gc && 122 : Compress::Zlib may not be available && 123 if test -f "$unhandled".gz 124 then 125 svn_cmd mkdir -m gz "$svnrepo"/gz && 126 git reset --hard$(git rev-list HEAD | tail -1)&& 127 git svn rebase && 128 test -f "$unhandled".gz && 129 test -f "$unhandled" && 130 for i in a b c "weird file name" gz "! !" 131 do 132 if ! test -d "$i" 133 then 134 echo >&2 "$idoes not exist" 135 exit 1 136 fi 137 done 138 fi 139 ) 140' 141 142test_done