Since --skip-hash is now a threshold parameter which applies to some
files and not others, it makes sense to allow --skip-compare to be
specified at the same time.
--skip-compare is respected for files smaller than the --skip-hash
threshold, since such files will always be hashed. --skip-compare is
ignored for files larger than or equal to the --skip-hash threshold
since such files will never be hashed.
my $collapse_timestamp = 0;
my $collapse_zero = 0;
my $skip_compares = 0;
my $collapse_timestamp = 0;
my $collapse_zero = 0;
my $skip_compares = 0;
+my $skip_compare_preference = 0;
my $skip_hashes = 0;
my $skip_hashes_threshold = 0;
my $progress = 0;
my $skip_hashes = 0;
my $skip_hashes_threshold = 0;
my $progress = 0;
} elsif ($arg eq '--zeros') {
$collapse_zero = 1;
} elsif ($arg eq '--trust' || $arg eq '--skip-compare') {
} elsif ($arg eq '--zeros') {
$collapse_zero = 1;
} elsif ($arg eq '--trust' || $arg eq '--skip-compare') {
+ $skip_compare_preference = 1;
} elsif ($arg =~ /^--skip-hash(?:=(\d+)([KkMmGgTt]?))?$/os) {
my ($quantity, $unit) = ($1, $2);
$unit ||= '_';
} elsif ($arg =~ /^--skip-hash(?:=(\d+)([KkMmGgTt]?))?$/os) {
my ($quantity, $unit) = ($1, $2);
$unit ||= '_';
t => 1000*1000*1000*1000,
T => 1024*1024*1024*1024,
);
t => 1000*1000*1000*1000,
T => 1024*1024*1024*1024,
);
- $skip_hashes = $skip_hashes_threshold = $quantity * $scale{$unit};
+ $skip_hashes = 0;
+ $skip_hashes_threshold = $quantity * $scale{$unit};
} elsif ($arg eq '--progress') {
$progress = 1;
} elsif ($arg eq '--verbose') {
} elsif ($arg eq '--progress') {
$progress = 1;
} elsif ($arg eq '--verbose') {
-if ($skip_hashes && $skip_compares) {
- die "Cannot skip both hashes and compares.\n";
-}
-
@directories or usage;
if (defined($lock_file) && !$dry_run) {
@directories or usage;
if (defined($lock_file) && !$dry_run) {
print STDERR "weak_key=$weak_key inode=$inode name=$name\n" if $debug;
print STDERR "weak_key=$weak_key inode=$inode name=$name\n" if $debug;
- $skip_hashes = $size >= $skip_hashes_threshold;
+ if ($size >= $skip_hashes_threshold) {
+ $skip_hashes = 1;
+ $skip_compares = 0;
+ } else {
+ $skip_hashes = 0;
+ $skip_compares = $skip_compare_preference;
+ }
$input_links++;
merge_files if $weak_key ne $current_key;
$input_links++;
merge_files if $weak_key ne $current_key;