70
$Git::SVN::_follow_parent = 1;
71
my %remote_opts = ( 'username=s' => \$Git::SVN::Prompt::_username,
72
'config-dir=s' => \$Git::SVN::Ra::config_dir,
73
- 'no-auth-cache' => \$Git::SVN::Prompt::_no_auth_cache );
73
+ 'no-auth-cache' => \$Git::SVN::Prompt::_no_auth_cache,
74
+ 'ignore-paths=s' => \$SVN::Git::Fetcher::_ignore_regex );
75
my %fc_opts = ( 'follow-parent|follow!' => \$Git::SVN::_follow_parent,
76
'authors-file|A=s' => \$_authors,
77
'repack:i' => \$Git::SVN::_repack,
3246
use Carp qw/croak/;
3247
use File::Temp qw/tempfile/;
3248
use IO::File qw//;
3249
+use vars qw/$_ignore_regex/;
3250
3251
# file baton members: path, mode_a, mode_b, pool, fh, blob, base
3252
sub new {
3299
$_[0] =~ m{(?:^|/)\.git(?:/|$)};
3300
}
3301
3302
+# return value: 0 -- don't ignore, 1 -- ignore
3303
+sub is_path_ignored {
3304
+ my ($path) = @_;
3305
+ return 1 if in_dot_git($path);
3306
+ return 0 unless defined($_ignore_regex);
3307
+ return 1 if $path =~ m!$_ignore_regex!o;
3308
+ return 0;
3309
+}
3310
+
3311
sub set_path_strip {
3312
my ($self, $path) = @_;
3313
$self->{path_strip} = qr/^\Q$path\E(\/|$)/ if length $path;
3333
3334
sub delete_entry {
3335
my ($self, $path, $rev, $pb) = @_;
3325
- return undef if in_dot_git($path);
3336
+ return undef if is_path_ignored($path);
3337
3338
my $gpath = $self->git_path($path);
3339
return undef if ($gpath eq '');
3363
my ($self, $path, $pb, $rev) = @_;
3364
my ($mode, $blob);
3365
3355
- goto out if in_dot_git($path);
3366
+ goto out if is_path_ignored($path);
3367
3368
my $gpath = $self->git_path($path);
3369
($mode, $blob) = (command('ls-tree', $self->{c}, '--', $gpath)
3383
my ($self, $path, $pb, $cp_path, $cp_rev) = @_;
3384
my $mode;
3385
3375
- if (!in_dot_git($path)) {
3386
+ if (!is_path_ignored($path)) {
3387
my ($dir, $file) = ($path =~ m#^(.*?)/?([^/]+)$#);
3388
delete $self->{empty}->{$dir};
3389
$mode = '100644';
3394
3395
sub add_directory {
3396
my ($self, $path, $cp_path, $cp_rev) = @_;
3386
- goto out if in_dot_git($path);
3397
+ goto out if is_path_ignored($path);
3398
my $gpath = $self->git_path($path);
3399
if ($gpath eq '') {
3400
my ($ls, $ctx) = command_output_pipe(qw/ls-tree
3418
3419
sub change_dir_prop {
3420
my ($self, $db, $prop, $value) = @_;
3410
- return undef if in_dot_git($db->{path});
3421
+ return undef if is_path_ignored($db->{path});
3422
$self->{dir_prop}->{$db->{path}} ||= {};
3423
$self->{dir_prop}->{$db->{path}}->{$prop} = $value;
3424
undef;
3426
3427
sub absent_directory {
3428
my ($self, $path, $pb) = @_;
3418
- return undef if in_dot_git($pb->{path});
3429
+ return undef if is_path_ignored($path);
3430
$self->{absent_dir}->{$pb->{path}} ||= [];
3431
push @{$self->{absent_dir}->{$pb->{path}}}, $path;
3432
undef;
3434
3435
sub absent_file {
3436
my ($self, $path, $pb) = @_;
3426
- return undef if in_dot_git($pb->{path});
3437
+ return undef if is_path_ignored($path);
3438
$self->{absent_file}->{$pb->{path}} ||= [];
3439
push @{$self->{absent_file}->{$pb->{path}}}, $path;
3440
undef;
3442
3443
sub change_file_prop {
3444
my ($self, $fb, $prop, $value) = @_;
3434
- return undef if in_dot_git($fb->{path});
3445
+ return undef if is_path_ignored($fb->{path});
3446
if ($prop eq 'svn:executable') {
3447
if ($fb->{mode_b} != 120000) {
3448
$fb->{mode_b} = defined $value ? 100755 : 100644;
3458
3459
sub apply_textdelta {
3460
my ($self, $fb, $exp) = @_;
3450
- return undef if (in_dot_git($fb->{path}));
3461
+ return undef if is_path_ignored($fb->{path});
3462
my $fh = $::_repository->temp_acquire('svn_delta');
3463
# $fh gets auto-closed() by SVN::TxDelta::apply(),
3464
# (but $base does not,) so dup() it for reading in close_file
3505
3506
sub close_file {
3507
my ($self, $fb, $exp) = @_;
3497
- return undef if (in_dot_git($fb->{path}));
3508
+ return undef if is_path_ignored($fb->{path});
3509
3510
my $hash;
3511
my $path = $self->git_path($fb->{path});