diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-08-11 18:20:26 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-08-11 18:20:26 +1200 |
commit | 0e6ec1fc6439ff3653c123579401f7940e925f10 (patch) | |
tree | 36f865d1da8aaa1a4a245f8e5922a4d8c5ee850a /checkem | |
parent | Add some jokes (diff) | |
download | checkem-0e6ec1fc6439ff3653c123579401f7940e925f10.tar.gz (sig) checkem-0e6ec1fc6439ff3653c123579401f7940e925f10.zip |
Apply sorts to keep output stablev2.10
Because Perl doesn't sort hash keys (and rightly so), the results are
the same but the blocks may not be in the same order, not the lines
within each block.
We may as well sort them to keep the output stable and improve
readability and prevent any confusion.
Diffstat (limited to 'checkem')
-rwxr-xr-x | checkem | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -25,7 +25,7 @@ use File::Find; use Digest; # Version number to make Perl::Critic happy -our $VERSION = 2.9; +our $VERSION = 2.10; # If no arguments, work with the current working directory if ( !@ARGV ) { @@ -119,7 +119,8 @@ for my $fs ( grep { @{$_} > 1 } values %sizes ) { } # Print the groups of matched files (more than one share a checksum in the -# final table) -for my $group ( grep { @{$_} > 1 } values %sums ) { - printf "%s\n\n", join "\n", map { $_->{name} } @{$group}; +# final table); apply gratuitous sorts, just so the output remains the same for +# identical file sets +for my $dig ( sort grep { @{ $sums{$_} } > 1 } keys %sums ) { + printf "%s\n\n", join "\n", sort map { $_->{name} } @{ $sums{$dig} }; } |