git-svnimport symlink support
added svn:special symlink support for access methods other than direct-http Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org> Acked-by: Matthias Urlichs <smurf@smurf.noris.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Herbert Valerio Riedel committed
Apr 17, 2006 at 06:58 UTC
08ddd4f7649ccf8b9f61c903de420bfd0a8a602e
1 file changed
+16
-2
git-svnimport.perl
+16
-2
@@ -98,6 +98,7 @@ package SVNconn;
98
use File::Spec;
99
use File::Temp qw(tempfile);
100
use POSIX qw(strftime dup2);
101
+use Fcntl qw(SEEK_SET);
102
103
sub new {
104
my($what,$repo) = @_;
@@ -143,9 +144,22 @@ sub file {
144
}
145
my $mode;
146
if (exists $properties->{'svn:executable'}) {
146
- $mode = '0755';
147
+ $mode = '100755';
148
+ } elsif (exists $properties->{'svn:special'}) {
149
+ my ($special_content, $filesize);
150
+ $filesize = tell $fh;
151
+ seek $fh, 0, SEEK_SET;
152
+ read $fh, $special_content, $filesize;
153
+ if ($special_content =~ s/^link //) {
154
+ $mode = '120000';
155
+ seek $fh, 0, SEEK_SET;
156
+ truncate $fh, 0;
157
+ print $fh $special_content;
158
+ } else {
159
+ die "unexpected svn:special file encountered";
160
+ }
161
} else {
148
- $mode = '0644';
162
+ $mode = '100644';
163
}
164
close ($fh);
165