Revert "Tweaks"

This reverts commit e01ea1c0de.
This commit is contained in:
Ruud H.G. van Tol 2017-10-27 10:48:44 +02:00
parent e01ea1c0de
commit 88009e42a1

View File

@ -8,11 +8,12 @@ open my $fh, "-|", "git ls-tree -r HEAD"
my %fs_sha1_path; my %fs_sha1_path;
while ( my $line= <$fh> ) { while ( my $line = <$fh> ) {
chomp $line; chomp $line;
if ( $line =~ m{ \A \d+ \s+ \w+ \s+ (\w+) \s+ (.*) \z }x ) { if ( $line =~ m{ \A \d+ \s+ \w+ \s+ (\w+) \s+ (.*) \z }x ) {
my ( $sha1, $path )= ($1, $2 ); my $sha1= $1;
my $path= $2;
if ( -f $path and !-l $path ) { if ( -f $path and !-l $path ) {
my $fs= -s $path; my $fs= -s $path;
$fs and push @{ $fs_sha1_path{ $fs }{ $sha1 } }, $path; $fs and push @{ $fs_sha1_path{ $fs }{ $sha1 } }, $path;
@ -21,11 +22,10 @@ while ( my $line= <$fh> ) {
} }
for my $fs ( sort { $a <=> $b } keys %fs_sha1_path ) { for my $fs ( sort { $a <=> $b } keys %fs_sha1_path ) {
for my $sha1 ( sort keys %{ $fs_sha1_path{ $fs } } ) { for my $sha1 (keys %{ $fs_sha1_path{ $fs } } ) {
if ( @{ $fs_sha1_path{ $fs }{ $sha1 } } > 1 ) { if ( @{ $fs_sha1_path{ $fs }{ $sha1 } } > 1 ) {
for my $path ( sort @{ $fs_sha1_path{ $fs }{ $sha1 } } ) { for my $path ( sort @{ $fs_sha1_path{ $fs }{ $sha1 } } ) {
say sprintf "%10d %s..%s %s", say sprintf "%10d %s %s", $fs, substr($sha1,0,7)."..".substr($sha1,-3), $path;
$fs, substr($sha1,0,7), substr($sha1,-3), $path;
} }
say '-', ' -' x 39; say '-', ' -' x 39;
} }
@ -35,3 +35,4 @@ for my $fs ( sort { $a <=> $b } keys %fs_sha1_path ) {
exit; exit;
__END__ __END__