Skip to content

Commit

Permalink
support directories in exclusion list, update #735
Browse files Browse the repository at this point in the history
  • Loading branch information
AlDanial committed Aug 29, 2023
1 parent 38782a3 commit 40dc7e9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
18 changes: 14 additions & 4 deletions Unix/cloc
Original file line number Diff line number Diff line change
Expand Up @@ -5201,12 +5201,22 @@ sub replace_git_hash_with_tarfile { # {{{1

}

#use Data::Dumper;
#print "files_union =\n", Dumper(\%files_union);
#print "repo_listing=\n", Dumper(\%repo_listing);
if ($opt_exclude_list_file) {
my @reject_list = read_list_file($opt_exclude_list_file);
foreach my $file (@reject_list) {
my %entries_to_drop = ();
foreach my $f_or_d (@reject_list) {
if (-d $f_or_d) {
# directory match
$entries_to_drop{$f_or_d} = 1;
foreach my $file (keys %files_union) {
$entries_to_drop{$file} = 1 if $file =~ m{$f_or_d/};
}
} else {
# exact match
$entries_to_drop{$f_or_d} = 1;
}
}
foreach my $file (keys %entries_to_drop) {
delete $files_union{$file};
}
}
Expand Down
18 changes: 14 additions & 4 deletions cloc
Original file line number Diff line number Diff line change
Expand Up @@ -5216,12 +5216,22 @@ sub replace_git_hash_with_tarfile { # {{{1

}

#use Data::Dumper;
#print "files_union =\n", Dumper(\%files_union);
#print "repo_listing=\n", Dumper(\%repo_listing);
if ($opt_exclude_list_file) {
my @reject_list = read_list_file($opt_exclude_list_file);
foreach my $file (@reject_list) {
my %entries_to_drop = ();
foreach my $f_or_d (@reject_list) {
if (-d $f_or_d) {
# directory match
$entries_to_drop{$f_or_d} = 1;
foreach my $file (keys %files_union) {
$entries_to_drop{$file} = 1 if $file =~ m{$f_or_d/};
}
} else {
# exact match
$entries_to_drop{$f_or_d} = 1;
}
}
foreach my $file (keys %entries_to_drop) {
delete $files_union{$file};
}
}
Expand Down

0 comments on commit 40dc7e9

Please sign in to comment.