Merge branch 'so/rebase-doc'
[gitweb.git] / perl / Git / SVN / Fetcher.pm
index 046a7a2f31cf923f634bd8b516b3da38ff989a46..10edb27732f439e5290a7b354efefeb10d219669 100644 (file)
@@ -1,6 +1,7 @@
 package Git::SVN::Fetcher;
-use vars qw/@ISA $_ignore_regex $_preserve_empty_dirs $_placeholder_filename
-            @deleted_gpath %added_placeholder $repo_id/;
+use vars qw/@ISA $_ignore_regex $_include_regex $_preserve_empty_dirs
+            $_placeholder_filename @deleted_gpath %added_placeholder
+            $repo_id/;
 use strict;
 use warnings;
 use SVN::Delta;
@@ -33,6 +34,10 @@ sub new {
        my $v = eval { command_oneline('config', '--get', $k) };
        $self->{ignore_regex} = $v;
 
+       $k = "svn-remote.$repo_id.include-paths";
+       $v = eval { command_oneline('config', '--get', $k) };
+       $self->{include_regex} = $v;
+
        $k = "svn-remote.$repo_id.preserve-empty-dirs";
        $v = eval { command_oneline('config', '--get', '--bool', $k) };
        if ($v && $v eq 'true') {
@@ -117,11 +122,18 @@ sub in_dot_git {
 }
 
 # return value: 0 -- don't ignore, 1 -- ignore
+# This will also check whether the path is explicitly included
 sub is_path_ignored {
        my ($self, $path) = @_;
        return 1 if in_dot_git($path);
        return 1 if defined($self->{ignore_regex}) &&
                    $path =~ m!$self->{ignore_regex}!;
+       return 0 if defined($self->{include_regex}) &&
+                   $path =~ m!$self->{include_regex}!;
+       return 0 if defined($_include_regex) &&
+                   $path =~ m!$_include_regex!;
+       return 1 if defined($self->{include_regex});
+       return 1 if defined($_include_regex);
        return 0 unless defined($_ignore_regex);
        return 1 if $path =~ m!$_ignore_regex!o;
        return 0;
@@ -303,11 +315,13 @@ sub change_file_prop {
 sub apply_textdelta {
        my ($self, $fb, $exp) = @_;
        return undef if $self->is_path_ignored($fb->{path});
-       my $fh = $::_repository->temp_acquire('svn_delta');
+       my $suffix = 0;
+       ++$suffix while $::_repository->temp_is_locked("svn_delta_${$}_$suffix");
+       my $fh = $::_repository->temp_acquire("svn_delta_${$}_$suffix");
        # $fh gets auto-closed() by SVN::TxDelta::apply(),
        # (but $base does not,) so dup() it for reading in close_file
        open my $dup, '<&', $fh or croak $!;
-       my $base = $::_repository->temp_acquire('git_blob');
+       my $base = $::_repository->temp_acquire("git_blob_${$}_$suffix");
 
        if ($fb->{blob}) {
                my ($base_is_link, $size);
@@ -512,6 +526,8 @@ sub stash_placeholder_list {
 1;
 __END__
 
+=head1 NAME
+
 Git::SVN::Fetcher - tree delta consumer for "git svn fetch"
 
 =head1 SYNOPSIS