mirror of
				https://codeberg.org/h3xx/simplify_static_dir
				synced 2024-08-14 23:57:24 +00:00 
			
		
		
		
	Limit "Skipped" output to only summary
This commit is contained in:
		
							parent
							
								
									967be362dc
								
							
						
					
					
						commit
						047df6c97b
					
				
					 2 changed files with 37 additions and 19 deletions
				
			
		|  | @ -8,6 +8,10 @@ All notable changes to this project will be documented in this file. | ||||||
| 
 | 
 | ||||||
| - Add progress bar | - Add progress bar | ||||||
| 
 | 
 | ||||||
|  | ### Changed | ||||||
|  | 
 | ||||||
|  | - Limit "Skipped" output to only summary | ||||||
|  | 
 | ||||||
| ## [3.0.0] | ## [3.0.0] | ||||||
| 
 | 
 | ||||||
| ### Changed | ### Changed | ||||||
|  |  | ||||||
|  | @ -142,24 +142,6 @@ MAIN: { | ||||||
|         # outright skip directories (don't report skip) |         # outright skip directories (don't report skip) | ||||||
|         return if -d $File::Find::name; |         return if -d $File::Find::name; | ||||||
| 
 | 
 | ||||||
|         # limit to or exclude file patterns specified by `-m' or `-M', |  | ||||||
|         # respectively |  | ||||||
| 
 |  | ||||||
|         # truth table |  | ||||||
|         # -m matches    | -M is used & matches  | !return? |  | ||||||
|         # 0     | 0         | 0 |  | ||||||
|         # 0     | 1         | 0 |  | ||||||
|         # 1     | 0         | 1 |  | ||||||
|         # 1     | 1         | 0 |  | ||||||
|         # note: m// will match everything |  | ||||||
|         unless ($File::Find::name =~ m/$opts{m}/ and |  | ||||||
|             !(length $opts{M} and $File::Find::name =~ m/$opts{M}/)) { |  | ||||||
| 
 |  | ||||||
|             print STDERR "Skipping path `$File::Find::name'\n" |  | ||||||
|                 if $opts{v}; |  | ||||||
|             return; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         # skip non-existent files and links |         # skip non-existent files and links | ||||||
|         unless (-f $File::Find::name && ! -l $File::Find::name) { |         unless (-f $File::Find::name && ! -l $File::Find::name) { | ||||||
|             return; |             return; | ||||||
|  | @ -172,6 +154,36 @@ MAIN: { | ||||||
|         scalar @files |         scalar @files | ||||||
|         if $opts{v}; |         if $opts{v}; | ||||||
| 
 | 
 | ||||||
|  |     # Limit to or exclude file patterns specified by `-m' or `-M', respectively | ||||||
|  |     # | ||||||
|  |     # Truth table: | ||||||
|  |     # -m matches    | -M is used & matches  | !return? | ||||||
|  |     # 0             | 0                     | 0 | ||||||
|  |     # 0             | 1                     | 0 | ||||||
|  |     # 1             | 0                     | 1 | ||||||
|  |     # 1             | 1                     | 0 | ||||||
|  |     # note: m// will match everything | ||||||
|  |     my $file_ct_before_filter = scalar @files; | ||||||
|  |     @files = grep { | ||||||
|  |         $_->{rel_name} =~ $opts{m} | ||||||
|  |     } @files; | ||||||
|  |     if ($file_ct_before_filter != scalar @files) { | ||||||
|  |         printf STDERR " (%d files filtered by -m rule)", | ||||||
|  |             $file_ct_before_filter - scalar @files | ||||||
|  |             if $opts{v}; | ||||||
|  |     } | ||||||
|  |     if (length $opts{M}) { | ||||||
|  |         $file_ct_before_filter = scalar @files; | ||||||
|  |         @files = grep { | ||||||
|  |             not $_->{rel_name} =~ $opts{M} | ||||||
|  |         } @files; | ||||||
|  |         if ($file_ct_before_filter != scalar @files) { | ||||||
|  |             printf STDERR " (%d files filtered by -M rule)", | ||||||
|  |                 $file_ct_before_filter - scalar @files | ||||||
|  |                 if $opts{v}; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     # Shortcut: Only generate hashes and inspect files that do not have a |     # Shortcut: Only generate hashes and inspect files that do not have a | ||||||
|     # unique size. The reasoning being that file sizes do not match, there's no |     # unique size. The reasoning being that file sizes do not match, there's no | ||||||
|     # possible way those two files can have the same contents. |     # possible way those two files can have the same contents. | ||||||
|  | @ -505,8 +517,10 @@ require Cwd; | ||||||
| 
 | 
 | ||||||
| sub new { | sub new { | ||||||
|     my $class = shift; |     my $class = shift; | ||||||
|  |     my $rel_name = shift; | ||||||
|     my $self = bless { |     my $self = bless { | ||||||
|         name => Cwd::abs_path(shift), |         rel_name => $rel_name, | ||||||
|  |         name => Cwd::abs_path($rel_name), | ||||||
|     }, $class; |     }, $class; | ||||||
|     (@{$self}{qw/ dev ino mode nlink uid gid rdev size |     (@{$self}{qw/ dev ino mode nlink uid gid rdev size | ||||||
|                 atime mtime ctime blksize blocks /}) |                 atime mtime ctime blksize blocks /}) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue