Merge branch 'jk/clone-dissociate' into maint
[git/mingw.git] / t / t9146-git-svn-empty-dirs.sh
blob6d3130e61856335dff7004903741a490ae94fc08
1 #!/bin/sh
3 # Copyright (c) 2009 Eric Wong
5 test_description='git svn creates empty directories'
6 . ./lib-git-svn.sh
8 test_expect_success 'initialize repo' '
9 for i in a b c d d/e d/e/f "weird file name"
11 svn_cmd mkdir -m "mkdir $i" "$svnrepo"/"$i"
12 done
15 test_expect_success 'clone' 'git svn clone "$svnrepo" cloned'
17 test_expect_success 'empty directories exist' '
19 cd cloned &&
20 for i in a b c d d/e d/e/f "weird file name"
22 if ! test -d "$i"
23 then
24 echo >&2 "$i does not exist"
25 exit 1
27 done
31 test_expect_success 'option automkdirs set to false' '
33 git svn init "$svnrepo" cloned-no-mkdirs &&
34 cd cloned-no-mkdirs &&
35 git config svn-remote.svn.automkdirs false &&
36 git svn fetch &&
37 for i in a b c d d/e d/e/f "weird file name"
39 if test -d "$i"
40 then
41 echo >&2 "$i exists"
42 exit 1
44 done
48 test_expect_success 'more emptiness' '
49 svn_cmd mkdir -m "bang bang" "$svnrepo"/"! !"
52 test_expect_success 'git svn rebase creates empty directory' '
53 ( cd cloned && git svn rebase ) &&
54 test -d cloned/"! !"
57 test_expect_success 'git svn mkdirs recreates empty directories' '
59 cd cloned &&
60 rm -r * &&
61 git svn mkdirs &&
62 for i in a b c d d/e d/e/f "weird file name" "! !"
64 if ! test -d "$i"
65 then
66 echo >&2 "$i does not exist"
67 exit 1
69 done
73 test_expect_success 'git svn mkdirs -r works' '
75 cd cloned &&
76 rm -r * &&
77 git svn mkdirs -r7 &&
78 for i in a b c d d/e d/e/f "weird file name"
80 if ! test -d "$i"
81 then
82 echo >&2 "$i does not exist"
83 exit 1
85 done
87 if test -d "! !"
88 then
89 echo >&2 "$i should not exist"
90 exit 1
93 git svn mkdirs -r8 &&
94 if ! test -d "! !"
95 then
96 echo >&2 "$i not exist"
97 exit 1
102 test_expect_success 'initialize trunk' '
103 for i in trunk trunk/a trunk/"weird file name"
105 svn_cmd mkdir -m "mkdir $i" "$svnrepo"/"$i"
106 done
109 test_expect_success 'clone trunk' 'git svn clone -s "$svnrepo" trunk'
111 test_expect_success 'empty directories in trunk exist' '
113 cd trunk &&
114 for i in a "weird file name"
116 if ! test -d "$i"
117 then
118 echo >&2 "$i does not exist"
119 exit 1
121 done
125 test_expect_success 'remove a top-level directory from svn' '
126 svn_cmd rm -m "remove d" "$svnrepo"/d
129 test_expect_success 'removed top-level directory does not exist' '
130 git svn clone "$svnrepo" removed &&
131 test ! -e removed/d
134 unhandled=.git/svn/refs/remotes/git-svn/unhandled.log
135 test_expect_success 'git svn gc-ed files work' '
137 cd removed &&
138 git svn gc &&
139 : Compress::Zlib may not be available &&
140 if test -f "$unhandled".gz
141 then
142 svn_cmd mkdir -m gz "$svnrepo"/gz &&
143 git reset --hard $(git rev-list HEAD | tail -1) &&
144 git svn rebase &&
145 test -f "$unhandled".gz &&
146 test -f "$unhandled" &&
147 for i in a b c "weird file name" gz "! !"
149 if ! test -d "$i"
150 then
151 echo >&2 "$i does not exist"
152 exit 1
154 done
159 test_done