Skip to content

Commit 08ddd4f

Browse files
hvrJunio C Hamano
authored andcommitted
git-svnimport symlink support
added svn:special symlink support for access methods other than direct-http Signed-off-by: Herbert Valerio Riedel <[email protected]> Acked-by: Matthias Urlichs <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2855d58 commit 08ddd4f

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

git-svnimport.perl

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ package SVNconn;
9898
use File::Spec;
9999
use File::Temp qw(tempfile);
100100
use POSIX qw(strftime dup2);
101+
use Fcntl qw(SEEK_SET);
101102

102103
sub new {
103104
my($what,$repo) = @_;
@@ -143,9 +144,22 @@ sub file {
143144
}
144145
my $mode;
145146
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+
}
147161
} else {
148-
$mode = '0644';
162+
$mode = '100644';
149163
}
150164
close ($fh);
151165

0 commit comments

Comments
 (0)