Eric Wong | 96a40b2 | 2006-02-20 10:57:29 -0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2006 Eric Wong |
| 4 | # |
| 5 | |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 6 | test_description='git svn basic tests' |
Ramsay Jones | 952182b | 2008-07-08 23:59:25 +0100 | [diff] [blame] | 7 | GIT_SVN_LC_ALL=${LC_ALL:-$LANG} |
Eric Wong | dc62e25 | 2006-06-28 03:07:14 -0700 | [diff] [blame] | 8 | |
Eric Wong | 36f5b1f | 2006-05-23 19:23:41 -0700 | [diff] [blame] | 9 | . ./lib-git-svn.sh |
Eric Wong | 96a40b2 | 2006-02-20 10:57:29 -0800 | [diff] [blame] | 10 | |
Johannes Sixt | 7b7247b | 2009-02-24 21:13:39 +0100 | [diff] [blame] | 11 | case "$GIT_SVN_LC_ALL" in |
| 12 | *.UTF-8) |
| 13 | test_set_prereq UTF8 |
| 14 | ;; |
| 15 | *) |
Ævar Arnfjörð Bjarmason | fadb515 | 2010-06-24 17:44:48 +0000 | [diff] [blame] | 16 | say "# UTF-8 locale not set, some tests skipped ($GIT_SVN_LC_ALL)" |
Johannes Sixt | 7b7247b | 2009-02-24 21:13:39 +0100 | [diff] [blame] | 17 | ;; |
| 18 | esac |
| 19 | |
Eric Wong | c0071ae | 2016-07-22 20:17:31 +0000 | [diff] [blame] | 20 | test_expect_success 'git svn --version works anywhere' ' |
Jeff King | a3c45d1 | 2016-12-15 21:31:59 -0500 | [diff] [blame] | 21 | nongit git svn --version |
Eric Wong | c0071ae | 2016-07-22 20:17:31 +0000 | [diff] [blame] | 22 | ' |
| 23 | |
| 24 | test_expect_success 'git svn help works anywhere' ' |
Jeff King | a3c45d1 | 2016-12-15 21:31:59 -0500 | [diff] [blame] | 25 | nongit git svn help |
Eric Wong | c0071ae | 2016-07-22 20:17:31 +0000 | [diff] [blame] | 26 | ' |
| 27 | |
Eric Wong | 96a40b2 | 2006-02-20 10:57:29 -0800 | [diff] [blame] | 28 | test_expect_success \ |
Nanako Shiraishi | f964732 | 2008-09-10 06:25:27 +0900 | [diff] [blame] | 29 | 'initialize git svn' ' |
Eric Wong | 39ed7c1 | 2006-12-26 16:27:37 -0800 | [diff] [blame] | 30 | mkdir import && |
Jonathan Nieder | 18a8269 | 2010-09-06 20:42:54 -0500 | [diff] [blame] | 31 | ( |
| 32 | cd import && |
| 33 | echo foo >foo && |
| 34 | ln -s foo foo.link |
| 35 | mkdir -p dir/a/b/c/d/e && |
| 36 | echo "deep dir" >dir/a/b/c/d/e/file && |
| 37 | mkdir bar && |
| 38 | echo "zzz" >bar/zzz && |
Michael J Gruber | 2605e95 | 2016-02-07 20:11:37 +0100 | [diff] [blame] | 39 | echo "#!/bin/sh" >exec.sh && |
| 40 | chmod +x exec.sh && |
Jonathan Nieder | 18a8269 | 2010-09-06 20:42:54 -0500 | [diff] [blame] | 41 | svn_cmd import -m "import for git svn" . "$svnrepo" >/dev/null |
Jens Lehmann | fd4ec4f | 2010-09-06 20:39:54 +0200 | [diff] [blame] | 42 | ) && |
Eric Wong | 39ed7c1 | 2006-12-26 16:27:37 -0800 | [diff] [blame] | 43 | rm -rf import && |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 44 | git svn init "$svnrepo"' |
Eric Wong | 96a40b2 | 2006-02-20 10:57:29 -0800 | [diff] [blame] | 45 | |
| 46 | test_expect_success \ |
| 47 | 'import an SVN revision into git' \ |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 48 | 'git svn fetch' |
Eric Wong | 96a40b2 | 2006-02-20 10:57:29 -0800 | [diff] [blame] | 49 | |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 50 | test_expect_success "checkout from svn" 'svn co "$svnrepo" "$SVN_TREE"' |
Eric Wong | 96a40b2 | 2006-02-20 10:57:29 -0800 | [diff] [blame] | 51 | |
| 52 | name='try a deep --rmdir with a commit' |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 53 | test_expect_success "$name" ' |
Jeff King | e1c0c15 | 2016-05-13 16:47:14 -0400 | [diff] [blame] | 54 | git checkout -f -b mybranch remotes/git-svn && |
Eric Wong | 39ed7c1 | 2006-12-26 16:27:37 -0800 | [diff] [blame] | 55 | mv dir/a/b/c/d/e/file dir/file && |
| 56 | cp dir/file file && |
| 57 | git update-index --add --remove dir/a/b/c/d/e/file dir/file file && |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 58 | git commit -m "$name" && |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 59 | git svn set-tree --find-copies-harder --rmdir \ |
Jeff King | e1c0c15 | 2016-05-13 16:47:14 -0400 | [diff] [blame] | 60 | remotes/git-svn..mybranch && |
Eygene Ryabinkin | da083d6 | 2009-05-08 12:06:16 +0400 | [diff] [blame] | 61 | svn_cmd up "$SVN_TREE" && |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 62 | test -d "$SVN_TREE"/dir && test ! -d "$SVN_TREE"/dir/a' |
Eric Wong | 96a40b2 | 2006-02-20 10:57:29 -0800 | [diff] [blame] | 63 | |
| 64 | |
| 65 | name='detect node change from file to directory #1' |
Junio C Hamano | 41ac414 | 2008-02-01 01:50:53 -0800 | [diff] [blame] | 66 | test_expect_success "$name" " |
Eric Wong | 39ed7c1 | 2006-12-26 16:27:37 -0800 | [diff] [blame] | 67 | mkdir dir/new_file && |
| 68 | mv dir/file dir/new_file/file && |
| 69 | mv dir/new_file dir/file && |
| 70 | git update-index --remove dir/file && |
| 71 | git update-index --add dir/file/file && |
Junio C Hamano | 41ac414 | 2008-02-01 01:50:53 -0800 | [diff] [blame] | 72 | git commit -m '$name' && |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 73 | test_must_fail git svn set-tree --find-copies-harder --rmdir \ |
Jeff King | e1c0c15 | 2016-05-13 16:47:14 -0400 | [diff] [blame] | 74 | remotes/git-svn..mybranch |
Junio C Hamano | 2ab5ca8 | 2012-02-21 21:10:33 -0800 | [diff] [blame] | 75 | " |
Eric Wong | 96a40b2 | 2006-02-20 10:57:29 -0800 | [diff] [blame] | 76 | |
| 77 | |
| 78 | name='detect node change from directory to file #1' |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 79 | test_expect_success "$name" ' |
| 80 | rm -rf dir "$GIT_DIR"/index && |
Jeff King | e1c0c15 | 2016-05-13 16:47:14 -0400 | [diff] [blame] | 81 | git checkout -f -b mybranch2 remotes/git-svn && |
Eric Wong | 39ed7c1 | 2006-12-26 16:27:37 -0800 | [diff] [blame] | 82 | mv bar/zzz zzz && |
| 83 | rm -rf bar && |
| 84 | mv zzz bar && |
| 85 | git update-index --remove -- bar/zzz && |
| 86 | git update-index --add -- bar && |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 87 | git commit -m "$name" && |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 88 | test_must_fail git svn set-tree --find-copies-harder --rmdir \ |
Jeff King | e1c0c15 | 2016-05-13 16:47:14 -0400 | [diff] [blame] | 89 | remotes/git-svn..mybranch2 |
Junio C Hamano | 2ab5ca8 | 2012-02-21 21:10:33 -0800 | [diff] [blame] | 90 | ' |
Eric Wong | 96a40b2 | 2006-02-20 10:57:29 -0800 | [diff] [blame] | 91 | |
| 92 | |
| 93 | name='detect node change from file to directory #2' |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 94 | test_expect_success "$name" ' |
| 95 | rm -f "$GIT_DIR"/index && |
Jeff King | e1c0c15 | 2016-05-13 16:47:14 -0400 | [diff] [blame] | 96 | git checkout -f -b mybranch3 remotes/git-svn && |
Eric Wong | 39ed7c1 | 2006-12-26 16:27:37 -0800 | [diff] [blame] | 97 | rm bar/zzz && |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 98 | git update-index --remove bar/zzz && |
Eric Wong | 39ed7c1 | 2006-12-26 16:27:37 -0800 | [diff] [blame] | 99 | mkdir bar/zzz && |
| 100 | echo yyy > bar/zzz/yyy && |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 101 | git update-index --add bar/zzz/yyy && |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 102 | git commit -m "$name" && |
Steven Walter | 379862e | 2012-02-20 09:17:54 -0500 | [diff] [blame] | 103 | git svn set-tree --find-copies-harder --rmdir \ |
Jeff King | e1c0c15 | 2016-05-13 16:47:14 -0400 | [diff] [blame] | 104 | remotes/git-svn..mybranch3 && |
Steven Walter | 379862e | 2012-02-20 09:17:54 -0500 | [diff] [blame] | 105 | svn_cmd up "$SVN_TREE" && |
| 106 | test -d "$SVN_TREE"/bar/zzz && |
Junio C Hamano | 2ab5ca8 | 2012-02-21 21:10:33 -0800 | [diff] [blame] | 107 | test -e "$SVN_TREE"/bar/zzz/yyy |
| 108 | ' |
Eric Wong | 96a40b2 | 2006-02-20 10:57:29 -0800 | [diff] [blame] | 109 | |
| 110 | name='detect node change from directory to file #2' |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 111 | test_expect_success "$name" ' |
| 112 | rm -f "$GIT_DIR"/index && |
Jeff King | e1c0c15 | 2016-05-13 16:47:14 -0400 | [diff] [blame] | 113 | git checkout -f -b mybranch4 remotes/git-svn && |
Eric Wong | 39ed7c1 | 2006-12-26 16:27:37 -0800 | [diff] [blame] | 114 | rm -rf dir && |
| 115 | git update-index --remove -- dir/file && |
| 116 | touch dir && |
| 117 | echo asdf > dir && |
| 118 | git update-index --add -- dir && |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 119 | git commit -m "$name" && |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 120 | test_must_fail git svn set-tree --find-copies-harder --rmdir \ |
Jeff King | e1c0c15 | 2016-05-13 16:47:14 -0400 | [diff] [blame] | 121 | remotes/git-svn..mybranch4 |
Junio C Hamano | 2ab5ca8 | 2012-02-21 21:10:33 -0800 | [diff] [blame] | 122 | ' |
Eric Wong | 96a40b2 | 2006-02-20 10:57:29 -0800 | [diff] [blame] | 123 | |
| 124 | |
| 125 | name='remove executable bit from a file' |
Johannes Schindelin | bcb11f1 | 2016-01-27 17:20:08 +0100 | [diff] [blame] | 126 | test_expect_success POSIXPERM "$name" ' |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 127 | rm -f "$GIT_DIR"/index && |
Jeff King | e1c0c15 | 2016-05-13 16:47:14 -0400 | [diff] [blame] | 128 | git checkout -f -b mybranch5 remotes/git-svn && |
Eric Wong | 39ed7c1 | 2006-12-26 16:27:37 -0800 | [diff] [blame] | 129 | chmod -x exec.sh && |
| 130 | git update-index exec.sh && |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 131 | git commit -m "$name" && |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 132 | git svn set-tree --find-copies-harder --rmdir \ |
Jeff King | e1c0c15 | 2016-05-13 16:47:14 -0400 | [diff] [blame] | 133 | remotes/git-svn..mybranch5 && |
Eygene Ryabinkin | da083d6 | 2009-05-08 12:06:16 +0400 | [diff] [blame] | 134 | svn_cmd up "$SVN_TREE" && |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 135 | test ! -x "$SVN_TREE"/exec.sh' |
Eric Wong | 96a40b2 | 2006-02-20 10:57:29 -0800 | [diff] [blame] | 136 | |
| 137 | |
| 138 | name='add executable bit back file' |
Johannes Schindelin | bcb11f1 | 2016-01-27 17:20:08 +0100 | [diff] [blame] | 139 | test_expect_success POSIXPERM "$name" ' |
Eric Wong | 39ed7c1 | 2006-12-26 16:27:37 -0800 | [diff] [blame] | 140 | chmod +x exec.sh && |
| 141 | git update-index exec.sh && |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 142 | git commit -m "$name" && |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 143 | git svn set-tree --find-copies-harder --rmdir \ |
Jeff King | e1c0c15 | 2016-05-13 16:47:14 -0400 | [diff] [blame] | 144 | remotes/git-svn..mybranch5 && |
Eygene Ryabinkin | da083d6 | 2009-05-08 12:06:16 +0400 | [diff] [blame] | 145 | svn_cmd up "$SVN_TREE" && |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 146 | test -x "$SVN_TREE"/exec.sh' |
Eric Wong | 96a40b2 | 2006-02-20 10:57:29 -0800 | [diff] [blame] | 147 | |
| 148 | |
Steven Walter | 379862e | 2012-02-20 09:17:54 -0500 | [diff] [blame] | 149 | name='executable file becomes a symlink to file' |
Johannes Schindelin | bcb11f1 | 2016-01-27 17:20:08 +0100 | [diff] [blame] | 150 | test_expect_success SYMLINKS "$name" ' |
Eric Wong | 5bd3870 | 2006-12-31 21:49:46 -0800 | [diff] [blame] | 151 | rm exec.sh && |
Steven Walter | 379862e | 2012-02-20 09:17:54 -0500 | [diff] [blame] | 152 | ln -s file exec.sh && |
Eric Wong | 5bd3870 | 2006-12-31 21:49:46 -0800 | [diff] [blame] | 153 | git update-index exec.sh && |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 154 | git commit -m "$name" && |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 155 | git svn set-tree --find-copies-harder --rmdir \ |
Jeff King | e1c0c15 | 2016-05-13 16:47:14 -0400 | [diff] [blame] | 156 | remotes/git-svn..mybranch5 && |
Eygene Ryabinkin | da083d6 | 2009-05-08 12:06:16 +0400 | [diff] [blame] | 157 | svn_cmd up "$SVN_TREE" && |
Jeff King | afa0876 | 2010-09-21 20:35:59 -0400 | [diff] [blame] | 158 | test -h "$SVN_TREE"/exec.sh' |
Eric Wong | 96a40b2 | 2006-02-20 10:57:29 -0800 | [diff] [blame] | 159 | |
Eric Wong | 5bd3870 | 2006-12-31 21:49:46 -0800 | [diff] [blame] | 160 | name='new symlink is added to a file that was also just made executable' |
Eric Wong | 96a40b2 | 2006-02-20 10:57:29 -0800 | [diff] [blame] | 161 | |
Johannes Schindelin | bcb11f1 | 2016-01-27 17:20:08 +0100 | [diff] [blame] | 162 | test_expect_success POSIXPERM,SYMLINKS "$name" ' |
Steven Walter | 379862e | 2012-02-20 09:17:54 -0500 | [diff] [blame] | 163 | chmod +x file && |
| 164 | ln -s file exec-2.sh && |
| 165 | git update-index --add file exec-2.sh && |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 166 | git commit -m "$name" && |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 167 | git svn set-tree --find-copies-harder --rmdir \ |
Jeff King | e1c0c15 | 2016-05-13 16:47:14 -0400 | [diff] [blame] | 168 | remotes/git-svn..mybranch5 && |
Eygene Ryabinkin | da083d6 | 2009-05-08 12:06:16 +0400 | [diff] [blame] | 169 | svn_cmd up "$SVN_TREE" && |
Steven Walter | 379862e | 2012-02-20 09:17:54 -0500 | [diff] [blame] | 170 | test -x "$SVN_TREE"/file && |
Jeff King | afa0876 | 2010-09-21 20:35:59 -0400 | [diff] [blame] | 171 | test -h "$SVN_TREE"/exec-2.sh' |
Eric Wong | 96a40b2 | 2006-02-20 10:57:29 -0800 | [diff] [blame] | 172 | |
Eric Wong | 5bd3870 | 2006-12-31 21:49:46 -0800 | [diff] [blame] | 173 | name='modify a symlink to become a file' |
Johannes Schindelin | bcb11f1 | 2016-01-27 17:20:08 +0100 | [diff] [blame] | 174 | test_expect_success POSIXPERM,SYMLINKS "$name" ' |
Junio C Hamano | 2ab5ca8 | 2012-02-21 21:10:33 -0800 | [diff] [blame] | 175 | echo git help >help && |
Eric Wong | 5bd3870 | 2006-12-31 21:49:46 -0800 | [diff] [blame] | 176 | rm exec-2.sh && |
| 177 | cp help exec-2.sh && |
| 178 | git update-index exec-2.sh && |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 179 | git commit -m "$name" && |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 180 | git svn set-tree --find-copies-harder --rmdir \ |
Jeff King | e1c0c15 | 2016-05-13 16:47:14 -0400 | [diff] [blame] | 181 | remotes/git-svn..mybranch5 && |
Eygene Ryabinkin | da083d6 | 2009-05-08 12:06:16 +0400 | [diff] [blame] | 182 | svn_cmd up "$SVN_TREE" && |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 183 | test -f "$SVN_TREE"/exec-2.sh && |
Jeff King | afa0876 | 2010-09-21 20:35:59 -0400 | [diff] [blame] | 184 | test ! -h "$SVN_TREE"/exec-2.sh && |
Junio C Hamano | 3af8286 | 2008-05-23 22:28:56 -0700 | [diff] [blame] | 185 | test_cmp help "$SVN_TREE"/exec-2.sh' |
Eric Wong | 96a40b2 | 2006-02-20 10:57:29 -0800 | [diff] [blame] | 186 | |
Johannes Sixt | 7b7247b | 2009-02-24 21:13:39 +0100 | [diff] [blame] | 187 | name="commit with UTF-8 message: locale: $GIT_SVN_LC_ALL" |
| 188 | LC_ALL="$GIT_SVN_LC_ALL" |
| 189 | export LC_ALL |
Johannes Schindelin | bcb11f1 | 2016-01-27 17:20:08 +0100 | [diff] [blame] | 190 | # This test relies on the previous test, hence requires POSIXPERM,SYMLINKS |
| 191 | test_expect_success UTF8,POSIXPERM,SYMLINKS "$name" " |
Johannes Sixt | 7b7247b | 2009-02-24 21:13:39 +0100 | [diff] [blame] | 192 | echo '# hello' >> exec-2.sh && |
| 193 | git update-index exec-2.sh && |
| 194 | git commit -m 'éï∏' && |
| 195 | git svn set-tree HEAD" |
| 196 | unset LC_ALL |
Eric Wong | 96a40b2 | 2006-02-20 10:57:29 -0800 | [diff] [blame] | 197 | |
| 198 | name='test fetch functionality (svn => git) with alternate GIT_SVN_ID' |
| 199 | GIT_SVN_ID=alt |
| 200 | export GIT_SVN_ID |
| 201 | test_expect_success "$name" \ |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 202 | 'git svn init "$svnrepo" && git svn fetch && |
Jeff King | e1c0c15 | 2016-05-13 16:47:14 -0400 | [diff] [blame] | 203 | git rev-list --pretty=raw remotes/git-svn | grep ^tree | uniq > a && |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 204 | git rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b && |
Junio C Hamano | 3af8286 | 2008-05-23 22:28:56 -0700 | [diff] [blame] | 205 | test_cmp a b' |
Eric Wong | 96a40b2 | 2006-02-20 10:57:29 -0800 | [diff] [blame] | 206 | |
Eric Wong | 42d3287 | 2006-06-13 04:02:23 -0700 | [diff] [blame] | 207 | name='check imported tree checksums expected tree checksums' |
Eric Wong | 86f3637 | 2006-06-15 19:13:56 -0700 | [diff] [blame] | 208 | rm -f expected |
Johannes Sixt | 7b7247b | 2009-02-24 21:13:39 +0100 | [diff] [blame] | 209 | if test_have_prereq UTF8 |
Eric Wong | 86f3637 | 2006-06-15 19:13:56 -0700 | [diff] [blame] | 210 | then |
Steven Walter | 379862e | 2012-02-20 09:17:54 -0500 | [diff] [blame] | 211 | echo tree dc68b14b733e4ec85b04ab6f712340edc5dc936e > expected |
Eric Wong | 86f3637 | 2006-06-15 19:13:56 -0700 | [diff] [blame] | 212 | fi |
| 213 | cat >> expected <<\EOF |
Steven Walter | 379862e | 2012-02-20 09:17:54 -0500 | [diff] [blame] | 214 | tree c3322890dcf74901f32d216f05c5044f670ce632 |
| 215 | tree d3ccd5035feafd17b030c5732e7808cc49122853 |
| 216 | tree d03e1630363d4881e68929d532746b20b0986b83 |
| 217 | tree 149d63cd5878155c846e8c55d7d8487de283f89e |
| 218 | tree 312b76e4f64ce14893aeac8591eb3960b065e247 |
| 219 | tree 149d63cd5878155c846e8c55d7d8487de283f89e |
Eric Wong | 42d3287 | 2006-06-13 04:02:23 -0700 | [diff] [blame] | 220 | tree d667270a1f7b109f5eb3aaea21ede14b56bfdd6e |
| 221 | tree 8f51f74cf0163afc9ad68a4b1537288c4558b5a4 |
| 222 | EOF |
Eric Wong | e151611 | 2006-11-27 21:46:50 -0800 | [diff] [blame] | 223 | |
Johannes Schindelin | bcb11f1 | 2016-01-27 17:20:08 +0100 | [diff] [blame] | 224 | test_expect_success POSIXPERM,SYMLINKS "$name" "test_cmp a expected" |
Eric Wong | 42d3287 | 2006-06-13 04:02:23 -0700 | [diff] [blame] | 225 | |
Jeff King | 577dfd0 | 2016-05-13 16:47:18 -0400 | [diff] [blame] | 226 | test_expect_success 'exit if remote refs are ambigious' ' |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 227 | git config --add svn-remote.svn.fetch \ |
Jeff King | e1c0c15 | 2016-05-13 16:47:14 -0400 | [diff] [blame] | 228 | bar:refs/remotes/git-svn && |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 229 | test_must_fail git svn migrate |
Jeff King | 577dfd0 | 2016-05-13 16:47:18 -0400 | [diff] [blame] | 230 | ' |
Eric Wong | e6434f8 | 2007-01-23 16:29:23 -0800 | [diff] [blame] | 231 | |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 232 | test_expect_success 'exit if init-ing a would clobber a URL' ' |
| 233 | svnadmin create "${PWD}/svnrepo2" && |
| 234 | svn mkdir -m "mkdir bar" "${svnrepo}2/bar" && |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 235 | git config --unset svn-remote.svn.fetch \ |
Jeff King | e1c0c15 | 2016-05-13 16:47:14 -0400 | [diff] [blame] | 236 | "^bar:refs/remotes/git-svn$" && |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 237 | test_must_fail git svn init "${svnrepo}2/bar" |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 238 | ' |
Eric Wong | e6434f8 | 2007-01-23 16:29:23 -0800 | [diff] [blame] | 239 | |
| 240 | test_expect_success \ |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 241 | 'init allows us to connect to another directory in the same repo' ' |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 242 | git svn init --minimize-url -i bar "$svnrepo/bar" && |
Eric Wong | ccb6b6f | 2007-02-13 17:38:58 -0800 | [diff] [blame] | 243 | git config --get svn-remote.svn.fetch \ |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 244 | "^bar:refs/remotes/bar$" && |
Eric Wong | ccb6b6f | 2007-02-13 17:38:58 -0800 | [diff] [blame] | 245 | git config --get svn-remote.svn.fetch \ |
Jeff King | e1c0c15 | 2016-05-13 16:47:14 -0400 | [diff] [blame] | 246 | "^:refs/remotes/git-svn$" |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 247 | ' |
Eric Wong | b805b44 | 2007-01-22 13:52:04 -0800 | [diff] [blame] | 248 | |
Thomas Rast | 5eec27e | 2009-05-29 17:09:42 +0200 | [diff] [blame] | 249 | test_expect_success 'dcommit $rev does not clobber current branch' ' |
| 250 | git svn fetch -i bar && |
| 251 | git checkout -b my-bar refs/remotes/bar && |
| 252 | echo 1 > foo && |
| 253 | git add foo && |
| 254 | git commit -m "change 1" && |
| 255 | echo 2 > foo && |
| 256 | git add foo && |
| 257 | git commit -m "change 2" && |
| 258 | old_head=$(git rev-parse HEAD) && |
| 259 | git svn dcommit -i bar HEAD^ && |
| 260 | test $old_head = $(git rev-parse HEAD) && |
| 261 | test refs/heads/my-bar = $(git symbolic-ref HEAD) && |
| 262 | git log refs/remotes/bar | grep "change 1" && |
| 263 | ! git log refs/remotes/bar | grep "change 2" && |
| 264 | git checkout master && |
| 265 | git branch -D my-bar |
| 266 | ' |
| 267 | |
Jeff King | 577dfd0 | 2016-05-13 16:47:18 -0400 | [diff] [blame] | 268 | test_expect_success 'able to dcommit to a subdirectory' ' |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 269 | git svn fetch -i bar && |
Eric Wong | d3a840d | 2007-01-26 01:32:45 -0800 | [diff] [blame] | 270 | git checkout -b my-bar refs/remotes/bar && |
| 271 | echo abc > d && |
| 272 | git update-index --add d && |
Jeff King | 577dfd0 | 2016-05-13 16:47:18 -0400 | [diff] [blame] | 273 | git commit -m "/bar/d should be in the log" && |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 274 | git svn dcommit -i bar && |
Jeff King | 577dfd0 | 2016-05-13 16:47:18 -0400 | [diff] [blame] | 275 | test -z "$(git diff refs/heads/my-bar refs/remotes/bar)" && |
Eric Wong | d3a840d | 2007-01-26 01:32:45 -0800 | [diff] [blame] | 276 | mkdir newdir && |
| 277 | echo new > newdir/dir && |
| 278 | git update-index --add newdir/dir && |
Jeff King | 577dfd0 | 2016-05-13 16:47:18 -0400 | [diff] [blame] | 279 | git commit -m "add a new directory" && |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 280 | git svn dcommit -i bar && |
Jeff King | 577dfd0 | 2016-05-13 16:47:18 -0400 | [diff] [blame] | 281 | test -z "$(git diff refs/heads/my-bar refs/remotes/bar)" && |
Eric Wong | d3a840d | 2007-01-26 01:32:45 -0800 | [diff] [blame] | 282 | echo foo >> newdir/dir && |
| 283 | git update-index newdir/dir && |
Jeff King | 577dfd0 | 2016-05-13 16:47:18 -0400 | [diff] [blame] | 284 | git commit -m "modify a file in new directory" && |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 285 | git svn dcommit -i bar && |
Jeff King | 577dfd0 | 2016-05-13 16:47:18 -0400 | [diff] [blame] | 286 | test -z "$(git diff refs/heads/my-bar refs/remotes/bar)" |
| 287 | ' |
Eric Wong | d3a840d | 2007-01-26 01:32:45 -0800 | [diff] [blame] | 288 | |
David D. Kilzer | 181264a | 2010-08-02 12:58:19 -0700 | [diff] [blame] | 289 | test_expect_success 'dcommit should not fail with a touched file' ' |
| 290 | test_commit "commit-new-file-foo2" foo2 && |
| 291 | test-chmtime =-60 foo && |
| 292 | git svn dcommit |
| 293 | ' |
| 294 | |
| 295 | test_expect_success 'rebase should not fail with a touched file' ' |
| 296 | test-chmtime =-60 foo && |
| 297 | git svn rebase |
| 298 | ' |
| 299 | |
Jeff King | 577dfd0 | 2016-05-13 16:47:18 -0400 | [diff] [blame] | 300 | test_expect_success 'able to set-tree to a subdirectory' ' |
Eric Wong | d3a840d | 2007-01-26 01:32:45 -0800 | [diff] [blame] | 301 | echo cba > d && |
| 302 | git update-index d && |
Jeff King | 577dfd0 | 2016-05-13 16:47:18 -0400 | [diff] [blame] | 303 | git commit -m "update /bar/d" && |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 304 | git svn set-tree -i bar HEAD && |
Jeff King | 577dfd0 | 2016-05-13 16:47:18 -0400 | [diff] [blame] | 305 | test -z "$(git diff refs/heads/my-bar refs/remotes/bar)" |
| 306 | ' |
Eric Wong | d3a840d | 2007-01-26 01:32:45 -0800 | [diff] [blame] | 307 | |
Deskin Miller | 6e5121f | 2008-11-06 00:07:39 -0500 | [diff] [blame] | 308 | test_expect_success 'git-svn works in a bare repository' ' |
| 309 | mkdir bare-repo && |
| 310 | ( cd bare-repo && |
| 311 | git init --bare && |
| 312 | GIT_DIR=. git svn init "$svnrepo" && |
| 313 | git svn fetch ) && |
| 314 | rm -rf bare-repo |
| 315 | ' |
Barry Wardell | bc93ceb | 2013-01-21 01:22:02 +0000 | [diff] [blame] | 316 | test_expect_success 'git-svn works in in a repository with a gitdir: link' ' |
| 317 | mkdir worktree gitdir && |
| 318 | ( cd worktree && |
| 319 | git svn init "$svnrepo" && |
| 320 | git init --separate-git-dir ../gitdir && |
| 321 | git svn fetch ) && |
| 322 | rm -rf worktree gitdir |
| 323 | ' |
Deskin Miller | 6e5121f | 2008-11-06 00:07:39 -0500 | [diff] [blame] | 324 | |
Eric Wong | 96a40b2 | 2006-02-20 10:57:29 -0800 | [diff] [blame] | 325 | test_done |