git-svn: use SVN::Ra::get_dir2 when possible

This avoids the following failure with normal "get_dir" on newer versions of SVN (tested with SVN 1.8.8-1ubuntu3.1): Incorrect parameters given: Could not convert '%ld' into a number get_dir2 also has the potential to be more efficient by requesting less data. ref: <1414636504.45506.YahooMailBasic@web172304.mail.ir2.yahoo.com> ref: <1414722617.89476.YahooMailBasic@web172305.mail.ir2.yahoo.com> Signed-off-by: Eric Wong <normalperson@yhbt.net> Cc: Hin-Tak Leung <htl10@users.sourceforge.net>

Eric Wong committed Oct 31, 2014 at 10:34 UTC 7ffa35b0479dac547659f06b8a6ea7d31c57cc05
1 file changed +11 -1
perl/Git/SVN/Ra.pm
+11 -1
@@ -175,7 +175,17 @@ sub get_dir {
175 }
176 }
177 my $pool = SVN::Pool->new;
178 - my ($d, undef, $props) = $self->SUPER::get_dir($dir, $r, $pool);
178 + my ($d, undef, $props);
179 +
180 + if (::compare_svn_version('1.4.0') >= 0) {
181 + # n.b. in addition to being potentially more efficient,
182 + # this works around what appears to be a bug in some
183 + # SVN 1.8 versions
184 + my $kind = 1; # SVN_DIRENT_KIND
185 + ($d, undef, $props) = $self->get_dir2($dir, $r, $kind, $pool);
186 + } else {
187 + ($d, undef, $props) = $self->SUPER::get_dir($dir, $r, $pool);
188 + }
189 my %dirents = map { $_ => { kind => $d->{$_}->kind } } keys %$d;
190 $pool->clear;
191 if ($r != $cache->{r}) {