Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t9146-git-svn-empty-dirs.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t9146-git-svn-empty-dirs.sh` 128 lines ยท 2717 bytes Raw Blame History 1 #!/bin/sh 2 # 3 # Copyright (c) 2009 Eric Wong 4 5 test_description='git svn creates empty directories' 6 7 . ./lib-git-svn.sh 8 9 test_expect_success 'initialize repo' ' 10 for i in a b c d d/e d/e/f "weird file name" 11 do 12 svn_cmd mkdir -m "mkdir $i" "$svnrepo"/"$i" || return 1 13 done 14 ' 15 16 test_expect_success 'clone' 'git svn clone "$svnrepo" cloned' 17 18 test_expect_success 'empty directories exist' ' 19 ( 20 cd cloned && 21 for i in a b c d d/e d/e/f "weird file name" 22 do 23 test_path_is_dir "$i" || exit 1 24 done 25 ) 26 ' 27 28 test_expect_success 'option automkdirs set to false' ' 29 ( 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" 35 do 36 test_path_is_missing "$i" || exit 1 37 done 38 ) 39 ' 40 41 test_expect_success 'more emptiness' ' 42 svn_cmd mkdir -m "bang bang" "$svnrepo"/"! !" 43 ' 44 45 test_expect_success 'git svn rebase creates empty directory' ' 46 ( cd cloned && git svn rebase ) && 47 test_path_is_dir cloned/"! !" 48 ' 49 50 test_expect_success 'git svn mkdirs recreates empty directories' ' 51 ( 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" "! !" 56 do 57 test_path_is_dir "$i" || exit 1 58 done 59 ) 60 ' 61 62 test_expect_success 'git svn mkdirs -r works' ' 63 ( 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" 68 do 69 test_path_is_dir "$i" || exit 1 70 done && 71 72 test_path_is_missing "! !" || exit 1 && 73 74 git svn mkdirs -r8 && 75 test_path_is_dir "! !" || exit 1 76 ) 77 ' 78 79 test_expect_success 'initialize trunk' ' 80 for i in trunk trunk/a trunk/"weird file name" 81 do 82 svn_cmd mkdir -m "mkdir $i" "$svnrepo"/"$i" || return 1 83 done 84 ' 85 86 test_expect_success 'clone trunk' 'git svn clone -s "$svnrepo" trunk' 87 88 test_expect_success 'empty directories in trunk exist' ' 89 ( 90 cd trunk && 91 for i in a "weird file name" 92 do 93 test_path_is_dir "$i" || exit 1 94 done 95 ) 96 ' 97 98 test_expect_success 'remove a top-level directory from svn' ' 99 svn_cmd rm -m "remove d" "$svnrepo"/d 100 ' 101 102 test_expect_success 'removed top-level directory does not exist' ' 103 git svn clone "$svnrepo" removed && 104 test_path_is_missing removed/d 105 106 ' 107 unhandled=.git/svn/refs/remotes/git-svn/unhandled.log 108 test_expect_success 'git svn gc-ed files work' ' 109 ( 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 "! !" 121 do 122 test_path_is_dir "$i" || exit 1 123 done 124 fi 125 ) 126 ' 127 128 test_done