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

git-svn: fix "Malformed network data" with svn:// servers

We have a workaround for the reparent function not working correctly on the SVN native protocol servers. This workaround opens a new connection (SVN::Ra object) to the new URL/directory. Since libsvn appears limited to only supporting one connection at a time, this workaround invalidates the Git::SVN::Ra object that is $self inside gs_fetch_loop_common(). So we need to restart that connection once all the fetching is done for each loop iteration to be able to run get_log() successfully. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Eric Wong committed Sep 7, 2007 at 04:00 UTC a51cdb0c0420ee3bef26bbd1a9aa75e1d464e5b7
1 file changed +13 -1
git-svn.perl
+13 -1
@@ -3013,7 +3013,7 @@ package Git::SVN::Ra;
3013 use vars qw/@ISA $config_dir $_log_window_size/;
3014 use strict;
3015 use warnings;
3016 -my ($can_do_switch, %ignored_err, $RA);
3016 +my ($ra_invalid, $can_do_switch, %ignored_err, $RA);
3017
3018 BEGIN {
3019 # enforce temporary pool usage for some simple functions
@@ -3174,7 +3174,11 @@ sub gs_do_switch {
3174 $self->{url} = $full_url;
3175 $reparented = 1;
3176 } else {
3177 + $_[0] = undef;
3178 + $self = undef;
3179 + $RA = undef;
3180 $ra = Git::SVN::Ra->new($full_url);
3181 + $ra_invalid = 1;
3182 }
3183 }
3184 $ra ||= $self;
@@ -3234,6 +3238,7 @@ sub gs_fetch_loop_common {
3238 my $inc = $_log_window_size;
3239 my ($min, $max) = ($base, $head < $base + $inc ? $head : $base + $inc);
3240 my $longest_path = longest_common_path($gsv, $globs);
3241 + my $ra_url = $self->{url};
3242 while (1) {
3243 my %revs;
3244 my $err;
@@ -3295,6 +3300,13 @@ sub gs_fetch_loop_common {
3300 "$g->{t}-maxRev";
3301 Git::SVN::tmp_config($k, $r);
3302 }
3303 + if ($ra_invalid) {
3304 + $_[0] = undef;
3305 + $self = undef;
3306 + $RA = undef;
3307 + $self = Git::SVN::Ra->new($ra_url);
3308 + $ra_invalid = undef;
3309 + }
3310 }
3311 # pre-fill the .rev_db since it'll eventually get filled in
3312 # with '0' x40 if something new gets committed