aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Rousse <guillomovitch@mandriva.org>2009-03-29 22:29:52 +0000
committerGuillaume Rousse <guillomovitch@mandriva.org>2009-03-29 22:29:52 +0000
commit809f5f2b2fac8bc90d73506711906b20c8970bc3 (patch)
tree729bed47afe05fd6fddfc3d36d665237e82c0236
parent61b1e400ac595cc2a46b706e184959a9fd5a7613 (diff)
downloadspec-helper-809f5f2b2fac8bc90d73506711906b20c8970bc3.tar
spec-helper-809f5f2b2fac8bc90d73506711906b20c8970bc3.tar.gz
spec-helper-809f5f2b2fac8bc90d73506711906b20c8970bc3.tar.bz2
spec-helper-809f5f2b2fac8bc90d73506711906b20c8970bc3.tar.xz
spec-helper-809f5f2b2fac8bc90d73506711906b20c8970bc3.zip
only test regexp if exclusion were defined, because the empty pattern always matches...
-rwxr-xr-xfix_eol6
1 files changed, 3 insertions, 3 deletions
diff --git a/fix_eol b/fix_eol
index 7158713..8634b46 100755
--- a/fix_eol
+++ b/fix_eol
@@ -13,12 +13,12 @@ die "Invalid build root" unless -d $buildroot;
# normalize build root
$buildroot =~ s|/$||;
-my $exclude_pattern = join('|',
+my $exclude_string = join('|',
map { '(:?' . quotemeta($_) . ')' }
$ENV{EXCLUDE_FROM_EOL_CONVERSION} ?
split(' ', $ENV{EXCLUDE_FROM_EOL_CONVERSION}) : ()
);
-$exclude_pattern = qr/$exclude_pattern/;
+my $exclude_pattern = qr/$exclude_string/;
find(\&convert, $buildroot);
@@ -30,7 +30,7 @@ sub convert {
# skip binary files
return unless -T $_;
# skip excluded files
- return if $File::Find::name =~ $exclude_pattern;
+ return if $exclude_string && $File::Find::name =~ $exclude_pattern;
# check if first line has less than 80 characters and ends with \r\n
open(my $in, '<', $_) or die "Unable to open file $_: $!";