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/t9107-git-svn-migrate.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 / t9107-git-svn-migrate.sh` 136 lines ยท 5021 bytes Raw Blame History 1 #!/bin/sh 2 # Copyright (c) 2006 Eric Wong 3 test_description='git svn metadata migrations from previous versions' 4 . ./lib-git-svn.sh 5 6 test_expect_success 'setup old-looking metadata' ' 7 cp "$GIT_DIR"/config "$GIT_DIR"/config-old-git-svn && 8 mkdir import && 9 ( 10 cd import && 11 for i in trunk branches/a branches/b tags/0.1 tags/0.2 tags/0.3 12 do 13 mkdir -p $i && 14 echo hello >>$i/README || 15 exit 1 16 done && 17 svn_cmd import -m test . "$svnrepo" 18 ) && 19 git svn init "$svnrepo" && 20 git svn fetch && 21 rm -rf "$GIT_DIR"/svn && 22 git update-ref refs/heads/git-svn-HEAD refs/remotes/git-svn && 23 git update-ref refs/heads/svn-HEAD refs/remotes/git-svn && 24 git update-ref -d refs/remotes/git-svn refs/remotes/git-svn 25 ' 26 27 test_expect_success 'git-svn-HEAD is a real HEAD' ' 28 git rev-parse --verify refs/heads/git-svn-HEAD^0 29 ' 30 31 svnrepo_escaped=$(echo $svnrepo | sed 's/ /%20/g') 32 33 test_expect_success 'initialize old-style (v0) git svn layout' ' 34 mkdir -p "$GIT_DIR"/git-svn/info "$GIT_DIR"/svn/info && 35 echo "$svnrepo" > "$GIT_DIR"/git-svn/info/url && 36 echo "$svnrepo" > "$GIT_DIR"/svn/info/url && 37 git svn migrate && 38 ! test -d "$GIT_DIR"/git-svn && 39 git rev-parse --verify refs/remotes/git-svn^0 && 40 git rev-parse --verify refs/remotes/svn^0 && 41 test "$(git config --get svn-remote.svn.url)" = "$svnrepo_escaped" && 42 test $(git config --get svn-remote.svn.fetch) = \ 43 ":refs/remotes/git-svn" 44 ' 45 46 test_expect_success 'initialize a multi-repository repo' ' 47 git svn init "$svnrepo" -T trunk -t tags -b branches && 48 git config --get-all svn-remote.svn.fetch > fetch.out && 49 test_grep "^trunk:refs/remotes/origin/trunk$" fetch.out && 50 test -n "$(git config --get svn-remote.svn.branches \ 51 "^branches/\*:refs/remotes/origin/\*$")" && 52 test -n "$(git config --get svn-remote.svn.tags \ 53 "^tags/\*:refs/remotes/origin/tags/\*$")" && 54 git config --unset svn-remote.svn.branches \ 55 "^branches/\*:refs/remotes/origin/\*$" && 56 git config --unset svn-remote.svn.tags \ 57 "^tags/\*:refs/remotes/origin/tags/\*$" && 58 git config --add svn-remote.svn.fetch "branches/a:refs/remotes/origin/a" && 59 git config --add svn-remote.svn.fetch "branches/b:refs/remotes/origin/b" && 60 for i in tags/0.1 tags/0.2 tags/0.3 61 do 62 git config --add svn-remote.svn.fetch \ 63 $i:refs/remotes/origin/$i || return 1 64 done && 65 git config --get-all svn-remote.svn.fetch > fetch.out && 66 test_grep "^trunk:refs/remotes/origin/trunk$" fetch.out && 67 test_grep "^branches/a:refs/remotes/origin/a$" fetch.out && 68 test_grep "^branches/b:refs/remotes/origin/b$" fetch.out && 69 test_grep "^tags/0\.1:refs/remotes/origin/tags/0\.1$" fetch.out && 70 test_grep "^tags/0\.2:refs/remotes/origin/tags/0\.2$" fetch.out && 71 test_grep "^tags/0\.3:refs/remotes/origin/tags/0\.3$" fetch.out && 72 test_grep "^:refs/remotes/git-svn" fetch.out 73 ' 74 75 # refs should all be different, but the trees should all be the same: 76 test_expect_success 'multi-fetch works on partial urls + paths' ' 77 refs="trunk a b tags/0.1 tags/0.2 tags/0.3" && 78 git svn multi-fetch && 79 for i in $refs 80 do 81 git rev-parse --verify refs/remotes/origin/$i^0 || return 1; 82 done >refs.out && 83 test -z "$(sort "$GIT_DIR"/svn/$ref/info/url || 107 return 1 108 done && 109 git svn migrate --minimize && 110 test -z "$(git config -l | grep "^svn-remote\.git-svn\.")" && 111 git config --get-all svn-remote.svn.fetch > fetch.out && 112 test_grep "^trunk:refs/remotes/origin/trunk$" fetch.out && 113 test_grep "^branches/a:refs/remotes/origin/a$" fetch.out && 114 test_grep "^branches/b:refs/remotes/origin/b$" fetch.out && 115 test_grep "^tags/0\.1:refs/remotes/origin/tags/0\.1$" fetch.out && 116 test_grep "^tags/0\.2:refs/remotes/origin/tags/0\.2$" fetch.out && 117 test_grep "^tags/0\.3:refs/remotes/origin/tags/0\.3$" fetch.out && 118 test_grep "^:refs/remotes/git-svn" fetch.out 119 ' 120 121 test_expect_success ".rev_db auto-converted to .rev_map.UUID" ' 122 git svn fetch -i trunk && 123 test -z "$(ls "$GIT_DIR"/svn/refs/remotes/origin/trunk/.rev_db.* 2>/dev/null)" && 124 expect="$(ls "$GIT_DIR"/svn/refs/remotes/origin/trunk/.rev_map.*)" && 125 test -n "$expect" && 126 rev_db="$(echo $expect | sed -e "s,_map,_db,")" && 127 convert_to_rev_db "$expect" "$rev_db" && 128 rm -f "$expect" && 129 test -f "$rev_db" && 130 git svn fetch -i trunk && 131 test -z "$(ls "$GIT_DIR"/svn/refs/remotes/origin/trunk/.rev_db.* 2>/dev/null)" && 132 test ! -e "$GIT_DIR"/svn/refs/remotes/origin/trunk/.rev_db && 133 test -f "$expect" 134 ' 135 136 test_done