gc: don't translate literal commands
[git/debian.git] / t / t9146-git-svn-empty-dirs.sh
blob79c26ed69c16cad42a32a555bb33635a154441e7
1 #!/bin/sh
3 # Copyright (c) 2009 Eric Wong
5 test_description='git svn creates empty directories'
7 TEST_FAILS_SANITIZE_LEAK=true
8 . ./lib-git-svn.sh
10 test_expect_success 'initialize repo' '
11 for i in a b c d d/e d/e/f "weird file name"
13 svn_cmd mkdir -m "mkdir $i" "$svnrepo"/"$i" || return 1
14 done
17 test_expect_success 'clone' 'git svn clone "$svnrepo" cloned'
19 test_expect_success 'empty directories exist' '
21 cd cloned &&
22 for i in a b c d d/e d/e/f "weird file name"
24 if ! test -d "$i"
25 then
26 echo >&2 "$i does not exist" &&
27 exit 1
29 done
33 test_expect_success 'option automkdirs set to false' '
35 git svn init "$svnrepo" cloned-no-mkdirs &&
36 cd cloned-no-mkdirs &&
37 git config svn-remote.svn.automkdirs false &&
38 git svn fetch &&
39 for i in a b c d d/e d/e/f "weird file name"
41 if test -d "$i"
42 then
43 echo >&2 "$i exists" &&
44 exit 1
46 done
50 test_expect_success 'more emptiness' '
51 svn_cmd mkdir -m "bang bang" "$svnrepo"/"! !"
54 test_expect_success 'git svn rebase creates empty directory' '
55 ( cd cloned && git svn rebase ) &&
56 test -d cloned/"! !"
59 test_expect_success 'git svn mkdirs recreates empty directories' '
61 cd cloned &&
62 rm -r * &&
63 git svn mkdirs &&
64 for i in a b c d d/e d/e/f "weird file name" "! !"
66 if ! test -d "$i"
67 then
68 echo >&2 "$i does not exist" &&
69 exit 1
71 done
75 test_expect_success 'git svn mkdirs -r works' '
77 cd cloned &&
78 rm -r * &&
79 git svn mkdirs -r7 &&
80 for i in a b c d d/e d/e/f "weird file name"
82 if ! test -d "$i"
83 then
84 echo >&2 "$i does not exist" &&
85 exit 1
87 done &&
89 if test -d "! !"
90 then
91 echo >&2 "$i should not exist" &&
92 exit 1
93 fi &&
95 git svn mkdirs -r8 &&
96 if ! test -d "! !"
97 then
98 echo >&2 "$i not exist" &&
99 exit 1
104 test_expect_success 'initialize trunk' '
105 for i in trunk trunk/a trunk/"weird file name"
107 svn_cmd mkdir -m "mkdir $i" "$svnrepo"/"$i" || return 1
108 done
111 test_expect_success 'clone trunk' 'git svn clone -s "$svnrepo" trunk'
113 test_expect_success 'empty directories in trunk exist' '
115 cd trunk &&
116 for i in a "weird file name"
118 if ! test -d "$i"
119 then
120 echo >&2 "$i does not exist" &&
121 exit 1
123 done
127 test_expect_success 'remove a top-level directory from svn' '
128 svn_cmd rm -m "remove d" "$svnrepo"/d
131 test_expect_success 'removed top-level directory does not exist' '
132 git svn clone "$svnrepo" removed &&
133 test ! -e removed/d
136 unhandled=.git/svn/refs/remotes/git-svn/unhandled.log
137 test_expect_success 'git svn gc-ed files work' '
139 cd removed &&
140 git svn gc &&
141 : Compress::Zlib may not be available &&
142 if test -f "$unhandled".gz
143 then
144 svn_cmd mkdir -m gz "$svnrepo"/gz &&
145 git reset --hard $(git rev-list HEAD | tail -1) &&
146 git svn rebase &&
147 test -f "$unhandled".gz &&
148 test -f "$unhandled" &&
149 for i in a b c "weird file name" gz "! !"
151 if ! test -d "$i"
152 then
153 echo >&2 "$i does not exist" &&
154 exit 1
156 done
161 test_done