@matheusbsbs / matheus-bagliano / commits / 0e8a002c59
Fork 0

git-svn: svn (command-line) 1.0.x compatibility

Tested on a plain Ubuntu Warty installation using subversion 1.0.6-1.2ubuntu3 svn add --force was never needed, as it only affected directories, which git (thankfully) doesn't track The 1.0.x also didn't support symlinks(!), so allow NO_SYMLINK to be defined for running tests Signed-off-by: Eric Wong <normalperson@yhbt.net>

Eric Wong committed Jun 15, 2006 at 19:51 UTC 0e8a002c59cbaca692dac81320be44c965588291
2 files changed +51 -43
contrib/git-svn/git-svn.perl
+2 -2
@@ -1306,12 +1306,12 @@ sub svn_checkout_tree {
1306 } elsif ($m->{chg} eq 'T') {
1307 sys(qw(svn rm --force),$m->{file_b});
1308 apply_mod_line_blob($m);
1309 - sys(qw(svn add --force), $m->{file_b});
1309 + sys(qw(svn add), $m->{file_b});
1310 svn_check_prop_executable($m);
1311 } elsif ($m->{chg} eq 'A') {
1312 svn_ensure_parent_path( $m->{file_b} );
1313 apply_mod_line_blob($m);
1314 - sys(qw(svn add --force), $m->{file_b});
1314 + sys(qw(svn add), $m->{file_b});
1315 svn_check_prop_executable($m);
1316 } else {
1317 croak "Invalid chg: $m->{chg}\n";
contrib/git-svn/t/t0000-contrib-git-svn.sh
+49 -41
@@ -11,7 +11,10 @@ mkdir import
11 cd import
12
13 echo foo > foo
14 -ln -s foo foo.link
14 +if test -z "$NO_SYMLINK"
15 +then
16 + ln -s foo foo.link
17 +fi
18 mkdir -p dir/a/b/c/d/e
19 echo 'deep dir' > dir/a/b/c/d/e/file
20 mkdir -p bar
@@ -129,46 +132,45 @@ test_expect_success "$name" \
132
133
134
132 -name='executable file becomes a symlink to bar/zzz (file)'
133 -rm exec.sh
134 -ln -s bar/zzz exec.sh
135 -git update-index exec.sh
136 -git commit -m "$name"
137 -
138 -test_expect_success "$name" \
139 - "git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
140 - svn up $SVN_TREE &&
141 - test -L $SVN_TREE/exec.sh"
142 -
143 -
144 -
145 -name='new symlink is added to a file that was also just made executable'
146 -chmod +x bar/zzz
147 -ln -s bar/zzz exec-2.sh
148 -git update-index --add bar/zzz exec-2.sh
149 -git commit -m "$name"
150 -
151 -test_expect_success "$name" \
152 - "git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
153 - svn up $SVN_TREE &&
154 - test -x $SVN_TREE/bar/zzz &&
155 - test -L $SVN_TREE/exec-2.sh"
156 -
157 -
158 -
159 -name='modify a symlink to become a file'
160 -git help > help || true
161 -rm exec-2.sh
162 -cp help exec-2.sh
163 -git update-index exec-2.sh
164 -git commit -m "$name"
165 -
166 -test_expect_success "$name" \
167 - "git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
168 - svn up $SVN_TREE &&
169 - test -f $SVN_TREE/exec-2.sh &&
170 - test ! -L $SVN_TREE/exec-2.sh &&
171 - diff -u help $SVN_TREE/exec-2.sh"
135 +if test -z "$NO_SYMLINK"
136 +then
137 + name='executable file becomes a symlink to bar/zzz (file)'
138 + rm exec.sh
139 + ln -s bar/zzz exec.sh
140 + git update-index exec.sh
141 + git commit -m "$name"
142 +
143 + test_expect_success "$name" \
144 + "git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
145 + svn up $SVN_TREE &&
146 + test -L $SVN_TREE/exec.sh"
147 +
148 + name='new symlink is added to a file that was also just made executable'
149 + chmod +x bar/zzz
150 + ln -s bar/zzz exec-2.sh
151 + git update-index --add bar/zzz exec-2.sh
152 + git commit -m "$name"
153 +
154 + test_expect_success "$name" \
155 + "git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
156 + svn up $SVN_TREE &&
157 + test -x $SVN_TREE/bar/zzz &&
158 + test -L $SVN_TREE/exec-2.sh"
159 +
160 + name='modify a symlink to become a file'
161 + git help > help || true
162 + rm exec-2.sh
163 + cp help exec-2.sh
164 + git update-index exec-2.sh
165 + git commit -m "$name"
166 +
167 + test_expect_success "$name" \
168 + "git-svn commit --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
169 + svn up $SVN_TREE &&
170 + test -f $SVN_TREE/exec-2.sh &&
171 + test ! -L $SVN_TREE/exec-2.sh &&
172 + diff -u help $SVN_TREE/exec-2.sh"
173 +fi
174
175
176 if test -n "$GIT_SVN_LC_ALL" && echo $GIT_SVN_LC_ALL | grep -q '\.UTF-8$'
@@ -193,6 +195,12 @@ test_expect_success "$name" \
195 git-rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b &&
196 diff -u a b"
197
198 +if test -n "$NO_SYMLINK"
199 +then
200 + test_done
201 + exit 0
202 +fi
203 +
204 name='check imported tree checksums expected tree checksums'
205 rm -f expected
206 if test -n "$GIT_SVN_LC_ALL" && echo $GIT_SVN_LC_ALL | grep -q '\.UTF-8$'