rebase: teach --autosquash to match on sha1 in addition to message
[git/kirr.git] / t / t9146-git-svn-empty-dirs.sh
blob565365cbd3ff80d816dd02b2072045cd25ae4b93
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 'more emptiness' '
32 svn_cmd mkdir -m "bang bang" "$svnrepo"/"! !"
35 test_expect_success 'git svn rebase creates empty directory' '
36 ( cd cloned && git svn rebase )
37 test -d cloned/"! !"
40 test_expect_success 'git svn mkdirs recreates empty directories' '
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" "! !"
47 if ! test -d "$i"
48 then
49 echo >&2 "$i does not exist"
50 exit 1
52 done
56 test_expect_success 'git svn mkdirs -r works' '
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"
63 if ! test -d "$i"
64 then
65 echo >&2 "$i does not exist"
66 exit 1
68 done
70 if test -d "! !"
71 then
72 echo >&2 "$i should not exist"
73 exit 1
76 git svn mkdirs -r8 &&
77 if ! test -d "! !"
78 then
79 echo >&2 "$i not exist"
80 exit 1
85 test_expect_success 'initialize trunk' '
86 for i in trunk trunk/a trunk/"weird file name"
88 svn_cmd mkdir -m "mkdir $i" "$svnrepo"/"$i"
89 done
92 test_expect_success 'clone trunk' 'git svn clone -s "$svnrepo" trunk'
94 test_expect_success 'empty directories in trunk exist' '
96 cd trunk &&
97 for i in a "weird file name"
99 if ! test -d "$i"
100 then
101 echo >&2 "$i does not exist"
102 exit 1
104 done
108 test_expect_success 'remove a top-level directory from svn' '
109 svn_cmd rm -m "remove d" "$svnrepo"/d
112 test_expect_success 'removed top-level directory does not exist' '
113 git svn clone "$svnrepo" removed &&
114 test ! -e removed/d
117 unhandled=.git/svn/refs/remotes/git-svn/unhandled.log
118 test_expect_success 'git svn gc-ed files work' '
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 "! !"
132 if ! test -d "$i"
133 then
134 echo >&2 "$i does not exist"
135 exit 1
137 done
142 test_done