Skip to content

Commit 4802426

Browse files
kwibergJunio C Hamano
authored andcommitted
svnimport: Convert executable flag
Convert the svn:executable property to file mode 755 when converting an SVN repository to GIT. Signed-off-by: Karl Hasselström <kha@treskal.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 525c0d7 commit 4802426

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

git-svnimport.perl

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,22 @@ sub file {
112112
DIR => File::Spec->tmpdir(), UNLINK => 1);
113113

114114
print "... $rev $path ...\n" if $opt_v;
115-
my $pool = SVN::Pool->new();
116-
eval { $self->{'svn'}->get_file($path,$rev,$fh,$pool); };
117-
$pool->clear;
115+
my (undef, $properties);
116+
eval { (undef, $properties)
117+
= $self->{'svn'}->get_file($path,$rev,$fh); };
118118
if($@) {
119119
return undef if $@ =~ /Attempted to get checksum/;
120120
die $@;
121121
}
122+
my $mode;
123+
if (exists $properties->{'svn:executable'}) {
124+
$mode = '0755';
125+
} else {
126+
$mode = '0644';
127+
}
122128
close ($fh);
123129

124-
return $name;
130+
return ($name, $mode);
125131
}
126132

127133
package main;
@@ -296,7 +302,7 @@ ($$$)
296302
my $svnpath = revert_split_path($branch,$path);
297303

298304
# now get it
299-
my $name;
305+
my ($name,$mode);
300306
if($opt_d) {
301307
my($req,$res);
302308

@@ -316,8 +322,9 @@ ($$$)
316322
return undef if $res->code == 301; # directory?
317323
die $res->status_line." at $url\n";
318324
}
325+
$mode = '0644'; # can't obtain mode via direct http request?
319326
} else {
320-
$name = $svn->file("$svnpath",$rev);
327+
($name,$mode) = $svn->file("$svnpath",$rev);
321328
return undef unless defined $name;
322329
}
323330

@@ -331,7 +338,6 @@ ($$$)
331338
chomp $sha;
332339
close $F;
333340
unlink $name;
334-
my $mode = "0644"; # SV does not seem to store any file modes
335341
return [$mode, $sha, $path];
336342
}
337343

0 commit comments

Comments
 (0)