Merge branch 'wl/new-command-doc'
[git.git] / t / t9146-git-svn-empty-dirs.sh
blob09606f1b3cfeb4244de4fbc12e4e96ddb7fd7de5
1 #!/bin/sh
3 # Copyright (c) 2009 Eric Wong
5 test_description='git svn creates empty directories'
7 . ./lib-git-svn.sh
9 test_expect_success 'initialize repo' '
10 for i in a b c d d/e d/e/f "weird file name"
12 svn_cmd mkdir -m "mkdir $i" "$svnrepo"/"$i" || return 1
13 done
16 test_expect_success 'clone' 'git svn clone "$svnrepo" cloned'
18 test_expect_success 'empty directories exist' '
20 cd cloned &&
21 for i in a b c d d/e d/e/f "weird file name"
23 if ! test -d "$i"
24 then
25 echo >&2 "$i does not exist" &&
26 exit 1
28 done
32 test_expect_success 'option automkdirs set to false' '
34 git svn init "$svnrepo" cloned-no-mkdirs &&
35 cd cloned-no-mkdirs &&
36 git config svn-remote.svn.automkdirs false &&
37 git svn fetch &&
38 for i in a b c d d/e d/e/f "weird file name"
40 if test -d "$i"
41 then
42 echo >&2 "$i exists" &&
43 exit 1
45 done
49 test_expect_success 'more emptiness' '
50 svn_cmd mkdir -m "bang bang" "$svnrepo"/"! !"
53 test_expect_success 'git svn rebase creates empty directory' '
54 ( cd cloned && git svn rebase ) &&
55 test -d cloned/"! !"
58 test_expect_success 'git svn mkdirs recreates empty directories' '
60 cd cloned &&
61 rm -r * &&
62 git svn mkdirs &&
63 for i in a b c d d/e d/e/f "weird file name" "! !"
65 if ! test -d "$i"
66 then
67 echo >&2 "$i does not exist" &&
68 exit 1
70 done
74 test_expect_success 'git svn mkdirs -r works' '
76 cd cloned &&
77 rm -r * &&
78 git svn mkdirs -r7 &&
79 for i in a b c d d/e d/e/f "weird file name"
81 if ! test -d "$i"
82 then
83 echo >&2 "$i does not exist" &&
84 exit 1
86 done &&
88 if test -d "! !"
89 then
90 echo >&2 "$i should not exist" &&
91 exit 1
92 fi &&
94 git svn mkdirs -r8 &&
95 if ! test -d "! !"
96 then
97 echo >&2 "$i not exist" &&
98 exit 1
103 test_expect_success 'initialize trunk' '
104 for i in trunk trunk/a trunk/"weird file name"
106 svn_cmd mkdir -m "mkdir $i" "$svnrepo"/"$i" || return 1
107 done
110 test_expect_success 'clone trunk' 'git svn clone -s "$svnrepo" trunk'
112 test_expect_success 'empty directories in trunk exist' '
114 cd trunk &&
115 for i in a "weird file name"
117 if ! test -d "$i"
118 then
119 echo >&2 "$i does not exist" &&
120 exit 1
122 done
126 test_expect_success 'remove a top-level directory from svn' '
127 svn_cmd rm -m "remove d" "$svnrepo"/d
130 test_expect_success 'removed top-level directory does not exist' '
131 git svn clone "$svnrepo" removed &&
132 test ! -e removed/d
135 unhandled=.git/svn/refs/remotes/git-svn/unhandled.log
136 test_expect_success 'git svn gc-ed files work' '
138 cd removed &&
139 git svn gc &&
140 : Compress::Zlib may not be available &&
141 if test -f "$unhandled".gz
142 then
143 svn_cmd mkdir -m gz "$svnrepo"/gz &&
144 git reset --hard $(git rev-list HEAD | tail -1) &&
145 git svn rebase &&
146 test -f "$unhandled".gz &&
147 test -f "$unhandled" &&
148 for i in a b c "weird file name" gz "! !"
150 if ! test -d "$i"
151 then
152 echo >&2 "$i does not exist" &&
153 exit 1
155 done
160 test_done