|
94 | 94 | my %remote_opts = ( 'username=s' => \$Git::SVN::Prompt::_username,
|
95 | 95 | 'config-dir=s' => \$Git::SVN::Ra::config_dir,
|
96 | 96 | 'no-auth-cache' => \$Git::SVN::Prompt::_no_auth_cache,
|
97 |
| - 'ignore-paths=s' => \$SVN::Git::Fetcher::_ignore_regex ); |
| 97 | + 'ignore-paths=s' => \$SVN::Git::Fetcher::_ignore_regex, |
| 98 | + 'ignore-refs=s' => \$Git::SVN::Ra::_ignore_refs_regex ); |
98 | 99 | my %fc_opts = ( 'follow-parent|follow!' => \$Git::SVN::_follow_parent,
|
99 | 100 | 'authors-file|A=s' => \$_authors,
|
100 | 101 | 'authors-prog=s' => \$_authors_prog,
|
@@ -440,9 +441,12 @@ sub do_git_init_db {
|
440 | 441 | command_noisy('config', "$pfx.$i", $icv{$i});
|
441 | 442 | $set = $i;
|
442 | 443 | }
|
443 |
| - my $ignore_regex = \$SVN::Git::Fetcher::_ignore_regex; |
444 |
| - command_noisy('config', "$pfx.ignore-paths", $$ignore_regex) |
445 |
| - if defined $$ignore_regex; |
| 444 | + my $ignore_paths_regex = \$SVN::Git::Fetcher::_ignore_regex; |
| 445 | + command_noisy('config', "$pfx.ignore-paths", $$ignore_paths_regex) |
| 446 | + if defined $$ignore_paths_regex; |
| 447 | + my $ignore_refs_regex = \$Git::SVN::Ra::_ignore_refs_regex; |
| 448 | + command_noisy('config', "$pfx.ignore-refs", $$ignore_refs_regex) |
| 449 | + if defined $$ignore_refs_regex; |
446 | 450 |
|
447 | 451 | if (defined $SVN::Git::Fetcher::_preserve_empty_dirs) {
|
448 | 452 | my $fname = \$SVN::Git::Fetcher::_placeholder_filename;
|
@@ -2192,6 +2196,8 @@ sub read_all_remotes {
|
2192 | 2196 | $r->{$1}->{url} = $2;
|
2193 | 2197 | } elsif (m!^(.+)\.pushurl=\s*(.*)\s*$!) {
|
2194 | 2198 | $r->{$1}->{pushurl} = $2;
|
| 2199 | + } elsif (m!^(.+)\.ignore-refs=\s*(.*)\s*$!) { |
| 2200 | + $r->{$1}->{ignore_refs_regex} = $2; |
2195 | 2201 | } elsif (m!^(.+)\.(branches|tags)=$svn_refspec$!) {
|
2196 | 2202 | my ($remote, $t, $local_ref, $remote_ref) =
|
2197 | 2203 | ($1, $2, $3, $4);
|
@@ -2228,6 +2234,16 @@ sub read_all_remotes {
|
2228 | 2234 | }
|
2229 | 2235 | } keys %$r;
|
2230 | 2236 |
|
| 2237 | + foreach my $remote (keys %$r) { |
| 2238 | + foreach ( grep { defined $_ } |
| 2239 | + map { $r->{$remote}->{$_} } qw(branches tags) ) { |
| 2240 | + foreach my $rs ( @$_ ) { |
| 2241 | + $rs->{ignore_refs_regex} = |
| 2242 | + $r->{$remote}->{ignore_refs_regex}; |
| 2243 | + } |
| 2244 | + } |
| 2245 | + } |
| 2246 | + |
2231 | 2247 | $r;
|
2232 | 2248 | }
|
2233 | 2249 |
|
@@ -5383,7 +5399,7 @@ sub apply_diff {
|
5383 | 5399 | }
|
5384 | 5400 |
|
5385 | 5401 | package Git::SVN::Ra;
|
5386 |
| -use vars qw/@ISA $config_dir $_log_window_size/; |
| 5402 | +use vars qw/@ISA $config_dir $_ignore_refs_regex $_log_window_size/; |
5387 | 5403 | use strict;
|
5388 | 5404 | use warnings;
|
5389 | 5405 | my ($ra_invalid, $can_do_switch, %ignored_err, $RA);
|
@@ -5841,6 +5857,17 @@ sub get_dir_globbed {
|
5841 | 5857 | @finalents;
|
5842 | 5858 | }
|
5843 | 5859 |
|
| 5860 | +# return value: 0 -- don't ignore, 1 -- ignore |
| 5861 | +sub is_ref_ignored { |
| 5862 | + my ($g, $p) = @_; |
| 5863 | + my $refname = $g->{ref}->full_path($p); |
| 5864 | + return 1 if defined($g->{ignore_refs_regex}) && |
| 5865 | + $refname =~ m!$g->{ignore_refs_regex}!; |
| 5866 | + return 0 unless defined($_ignore_refs_regex); |
| 5867 | + return 1 if $refname =~ m!$_ignore_refs_regex!o; |
| 5868 | + return 0; |
| 5869 | +} |
| 5870 | + |
5844 | 5871 | sub match_globs {
|
5845 | 5872 | my ($self, $exists, $paths, $globs, $r) = @_;
|
5846 | 5873 |
|
@@ -5877,6 +5904,7 @@ sub match_globs {
|
5877 | 5904 | next unless /$g->{path}->{regex}/;
|
5878 | 5905 | my $p = $1;
|
5879 | 5906 | my $pathname = $g->{path}->full_path($p);
|
| 5907 | + next if is_ref_ignored($g, $p); |
5880 | 5908 | next if $exists->{$pathname};
|
5881 | 5909 | next if ($self->check_path($pathname, $r) !=
|
5882 | 5910 | $SVN::Node::dir);
|
|
0 commit comments