t/README: add missing value for GIT_TEST_DEFAULT_REF_FORMAT
[git/gitster.git] / t / t9146-git-svn-empty-dirs.sh
blob926ac8143943c91493eb9be0e42ca365fae56971
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 test_path_is_dir "$i" || exit 1
24 done
28 test_expect_success 'option automkdirs set to false' '
30 git svn init "$svnrepo" cloned-no-mkdirs &&
31 cd cloned-no-mkdirs &&
32 git config svn-remote.svn.automkdirs false &&
33 git svn fetch &&
34 for i in a b c d d/e d/e/f "weird file name"
36 test_path_is_missing "$i" || exit 1
37 done
41 test_expect_success 'more emptiness' '
42 svn_cmd mkdir -m "bang bang" "$svnrepo"/"! !"
45 test_expect_success 'git svn rebase creates empty directory' '
46 ( cd cloned && git svn rebase ) &&
47 test_path_is_dir cloned/"! !"
50 test_expect_success 'git svn mkdirs recreates empty directories' '
52 cd cloned &&
53 rm -r * &&
54 git svn mkdirs &&
55 for i in a b c d d/e d/e/f "weird file name" "! !"
57 test_path_is_dir "$i" || exit 1
58 done
62 test_expect_success 'git svn mkdirs -r works' '
64 cd cloned &&
65 rm -r * &&
66 git svn mkdirs -r7 &&
67 for i in a b c d d/e d/e/f "weird file name"
69 test_path_is_dir "$i" || exit 1
70 done &&
72 test_path_is_missing "! !" || exit 1 &&
74 git svn mkdirs -r8 &&
75 test_path_is_dir "! !" || exit 1
79 test_expect_success 'initialize trunk' '
80 for i in trunk trunk/a trunk/"weird file name"
82 svn_cmd mkdir -m "mkdir $i" "$svnrepo"/"$i" || return 1
83 done
86 test_expect_success 'clone trunk' 'git svn clone -s "$svnrepo" trunk'
88 test_expect_success 'empty directories in trunk exist' '
90 cd trunk &&
91 for i in a "weird file name"
93 test_path_is_dir "$i" || exit 1
94 done
98 test_expect_success 'remove a top-level directory from svn' '
99 svn_cmd rm -m "remove d" "$svnrepo"/d
102 test_expect_success 'removed top-level directory does not exist' '
103 git svn clone "$svnrepo" removed &&
104 test_path_is_missing removed/d
107 unhandled=.git/svn/refs/remotes/git-svn/unhandled.log
108 test_expect_success 'git svn gc-ed files work' '
110 cd removed &&
111 git svn gc &&
112 : Compress::Zlib may not be available &&
113 if test -f "$unhandled".gz
114 then
115 svn_cmd mkdir -m gz "$svnrepo"/gz &&
116 git reset --hard $(git rev-list HEAD | tail -1) &&
117 git svn rebase &&
118 test_path_is_file "$unhandled".gz &&
119 test_path_is_file "$unhandled" &&
120 for i in a b c "weird file name" gz "! !"
122 test_path_is_dir "$i" || exit 1
123 done
128 test_done