Branch Coverage

blib/lib/DataStore/CAS/Simple.pm
Criterion Covered Total %
branch 111 196 56.6


line true false branch
36 0 16 if @inval
41 0 16 unless (-d $path)
42 0 0 unless $create
44 0 0 unless mkdir $path
50 13 3 unless (-f catfile($path, "conf", "VERSION"))
51 1 12 unless $create
64 9 3 if ($setup) { }
68 2 1 unless $self->validate($self->hash_of_null)
85 20 61 if ($create_dirs) { }
89 2 40 if -d $path
90 0 40 unless mkdir $path
101 12 0 if ref $class
102 12 0 @_ == 1 ? :
104 0 12 unless defined $params{'path'}
105 0 12 unless -d $params{'path'}
108 1 11 unless $class->_is_dir_empty($params{'path'})
118 0 9 unless mkdir $conf_dir
129 0 9 if (not $_->VERSION) { }
142 12 0 if ref $class
149 12 0 unless ($flags->{'ignore_version'})
152 0 12 unless defined $cur_ver
156 0 12 unless &try(sub { $pkg->VERSION($ver); 1; } , &catch(sub { 0; } ))
179 0 0 $len == $rawlen ? :
0 0 $len == $hexlen ? :
188 12 0 $fanout->[-1] =~ /^[0-9]+$/ ? :
191 12 0 if $filename_type eq "*"
195 0 0 if $hexlen != (length $hash || 0)
196 0 0 unless my(@dirs) = $hash =~ /$re/
201 0 81 if $hexlen != (length $hash || 0)
202 0 81 unless my(@dirs) = $hash =~ /$re/
205 12 0 $filename_type eq '*' ? :
0 12 $filename_type eq '=' ? :
217 0 0 unless defined $tmp
224 0 12 unless opendir my $dh, $path
226 14 12 if $_ ne "."
239 0 27 unless open my $f, ">", $path
241 0 27 unless print $f $content and close $f
247 0 36 unless open my $f, "<", $path
251 0 36 unless defined $str and length $str
266 55 0 if ($_ =~ /^(\d+)$/) { }
0 0 elsif ($_ eq '=' or $_ eq '*') { }
268 1 54 if $1 > $max_sane_level_fanout
272 0 0 unless \$_ == \$fanout[-1]
277 1 21 if $total_digits > $max_sane_total_fanout
284 0 12 unless $digest =~ /^(\S+)$/
293 0 12 unless $line =~ /^([A-Za-z0-9:_]+) ([0-9.]+)/
305 18 15 unless my($size, $blksize) = (stat $fname)[7, 11]
323 0 9 unless defined $file and $is_cas_file || $is_filename
327 4 5 if ($flags->{'hardlink'} or $flags->{'move'} and not $is_cas_file)
328 3 0 $is_cas_file && $file->can('local_file') ? :
1 3 $is_filename ? :
331 4 0 if ($fname and -f $fname)
332 0 4 $flags->{'known_hashes'} ? :
335 3 0 if $is_cas_file and $flags->{'reuse_hash'}
339 1 3 if (-f $self->path_for_hash($hash))
341 0 1 if $flags->{'stats'}
343 0 1 if $flags->{'move'}
352 1 2 $flags->{'move'} ? :
3 0 if $flags->{'move'} ? $self->_try_put_move($fname, $flags) : $self->_try_put_hardlink($fname, $flags)
366 0 1 unless rename $file, $tmp
367 0 1 if (ref $file and ref($file)->isa("File::Temp"))
374 0 1 unless my($mode, $uid, $gid) = (stat $tmp)[2, 4, 5]
376 1 0 unless ($flags->{'dry_run'})
377 0 1 if $uid and $uid != $> or $gid and $gid != $)
379 1 0 if 292 != ($mode & 511)
381 0 1 unless rename $tmp, $dest
385 0 1 if ($flags->{'stats'})
403 0 2 unless defined $mode and not $mode & 146
406 0 2 unless !$uid || $uid == $> and !$gid || $gid == $)
411 0 2 unless $flags->{'dry_run'} or link $file, $dest
414 0 2 if ($flags->{'stats'})
427 1 17 unless defined $known_hash and length $known_hash
436 18 0 unless $data->{'dry_run'}
439 1 17 unless defined $data->{'hash'}
451 18 0 defined $data->{'dest_file'} ? :
454 9 9 if (defined $wrote and $wrote > 0)
458 1 8 if defined $data->{'digest'}
479 17 1 defined $data->{'hash'} ? :
482 18 0 if (defined $temp_file)
484 0 18 unless close $temp_file
496 1 17 if (-f $dest_name) { }
497 0 1 if ($flags->{'stats'})
503 0 17 unless chmod 0444, "$source_file"
509 0 17 unless $flags->{'dry_run'} or rename "$source_file", $dest_name or $self->path_for_hash($hash, 1) and rename $source_file, $dest_name
513 0 17 if ($flags->{'stats'})
526 1 2 unless -f $path
528 0 2 unless open my $fh, "<:raw", $path
531 1 1 $hash eq $hash2 ? :
538 0 0 if $flags and $flags->{'layer'}
539 0 2 unless open my $fh, $mode, $file->local_file
558 0 15 unless @dirstack
563 3 41 unless @dirstack
570 41 12 if (-d $fname) { }
575 12 0 if ($#dirstack == $#length and -f $fname)
587 1 0 if (-f $path) { }
589 1 0 unless $flags and $flags->{'dry_run'}
591 0 0 if $flags and $flags->{'stats'}
595 0 0 if $flags and $flags->{'stats'}