Branch Coverage

blib/lib/Stow.pm
Criterion Covered Total %
branch 272 368 73.9


line true false branch
146 0 180 unless exists $opts{$required_arg}
152 139 941 exists $opts{$opt} ? :
155 0 90 if (%opts)
171 0 90 unless $self->{'test_mode'}
173 90 0 unless exists $ENV{'TEST_VERBOSE'}
174 0 0 unless length $ENV{'TEST_VERBOSE'}
177 0 0 unless $ENV{'TEST_VERBOSE'} =~ /^\d+$/
200 2 90 if (defined $dir)
274 0 40 unless @packages
281 0 40 unless (-d $pkg_path)
308 0 44 unless @packages
315 0 46 unless (-d $pkg_path)
355 0 136 unless chdir $self->{'target'}
405 1 110 if $self->should_skip_target($pkg_subdir)
419 0 110 unless $self->is_a_node($target_subdir)
422 0 110 unless opendir my $DIR, $pkg_path_from_cwd
429 110 287 if $node eq "."
430 110 177 if $node eq ".."
435 16 161 if $self->ignore($stow_path, $package, $target_node_path)
437 41 120 if ($self->{'dotfiles'})
439 29 12 if ($adjusted ne $node)
504 5 156 if (-l $pkg_path_from_cwd)
506 0 5 if ($link_dest =~ m[\A/])
531 38 123 if ($self->is_a_link($target_subpath)) { }
45 78 elsif ($self->is_a_node($target_subpath)) { }
10 68 elsif ($self->{'no-folding'} and -d $pkg_path_from_cwd and not -l $pkg_path_from_cwd) { }
534 0 38 unless ($existing_link_dest)
542 1 37 unless ($existing_pkg_path_from_cwd)
552 36 1 if ($self->is_a_node($existing_pkg_path_from_cwd)) { }
553 24 12 if ($existing_link_dest eq $link_dest) { }
1 11 elsif ($self->defer($target_subpath)) { }
1 10 elsif ($self->override($target_subpath)) { }
9 1 elsif ($self->is_a_dir(join_paths(parent($target_subpath), $existing_link_dest)) and $self->is_a_dir(join_paths(parent($target_subpath), $link_dest))) { }
606 39 6 if ($self->is_a_dir($target_subpath)) { }
607 2 37 if (not -d $pkg_path_from_cwd) { }
628 3 3 if ($self->{'adopt'}) { }
629 1 2 if (-d $pkg_path_from_cwd) { }
691 3 429 if ($target eq $self->{'stow_path'})
696 10 419 if ($self->marked_stow_dir($target))
701 0 419 if (-e join_paths($target, ".nonstow"))
715 12 491 if (-e join_paths($dir, ".stow"))
756 12 309 if $self->should_skip_target($target_subdir)
759 258 51 $self->{'compat'} ? :
770 258 51 if ($self->{'compat'}) { }
774 0 258 unless -d $target_subdir
780 0 51 unless -d $pkg_path_from_cwd
786 0 51 unless $self->is_a_node($target_subdir)
790 258 51 $self->{'compat'} ? :
791 0 309 unless opendir my $DIR, $dir
798 309 1325 if $node eq "."
799 309 1016 if $node eq ".."
805 6 1010 if $self->ignore($self->{'stow_path'}, $package, $target_node_path)
807 41 969 if ($self->{'dotfiles'})
808 5 36 if ($self->{'compat'}) { }
813 3 2 if ($adjusted ne $node)
822 24 12 if ($adjusted ne $node)
838 51 258 if (not $self->{'compat'} and -d $target_subdir)
882 75 935 if ($self->is_a_link($target_subpath)) { }
281 654 elsif (-d $target_subpath) { }
633 21 elsif (-e $target_subpath) { }
889 9 272 if (my $parent_in_pkg = $self->foldable($target_subpath))
908 0 75 unless ($link_dest)
912 0 75 if ($link_dest =~ m[\A/])
920 13 62 unless ($existing_pkg_path_from_cwd)
931 60 2 if (-e $existing_pkg_path_from_cwd) { }
932 34 26 if ($existing_pkg_path_from_cwd eq $pkg_path_from_cwd) { }
1021 2 143 if (substr($link_dest, 0, 1) eq "/")
1038 112 31 if (length $package)
1047 2 29 if (length $stow_path)
1077 33 116 unless ($removed)
1120 2 72 if ($self->marked_stow_dir($pkg_path_from_cwd))
1121 0 2 if ($last_segment == $#segments)
1162 0 55 unless (-d $dir)
1166 0 55 unless opendir my $DIR, $dir
1173 55 302 if $node eq "."
1174 55 247 if $node eq ".."
1178 180 67 unless -l $node_path
1182 26 41 if (exists $self->{'link_task_for'}{$node_path})
1184 0 26 if ($action ne 'remove') { }
1196 0 41 unless ($link_dest)
1202 31 10 if (-e $target_subpath) { }
1215 1 9 if ($owner)
1250 6 279 if ($self->{'no-folding'})
1255 0 279 unless opendir my $DIR, $target_subdir
1272 279 542 if $node eq "."
1273 279 263 if $node eq ".."
1278 13 250 unless $self->is_a_node($target_node_path)
1281 227 23 unless ($self->is_a_link($target_node_path))
1288 0 23 unless ($link_dest)
1292 18 5 if ($parent_in_pkg eq '') { }
5 0 elsif ($parent_in_pkg ne $new_parent) { }
1300 35 12 unless ($parent_in_pkg)
1313 10 2 if ($self->link_owned_by_package($target_subdir, $parent_in_pkg)) { }
1349 0 9 unless opendir my $DIR, $target_subdir
1356 9 20 if $node eq "."
1357 9 11 if $node eq ".."
1358 2 9 unless $self->is_a_node(join_paths($target_subdir, $node))
1482 0 1464 unless length $target
1486 4 146 if ($target =~ /$suffix/)
1495 1458 0 defined $path_regexp ? :
1497 1343 115 defined $segment_regexp ? :
1500 25 1433 if (defined $path_regexp and ("/$target") =~ /$path_regexp/)
1506 26 1407 if (defined $segment_regexp and $basename =~ /$segment_regexp/)
1530 266 2430 if (-e $file) { }
1549 244 22 if (exists $ignore_file_regexps{$file})
1554 0 22 unless (open REGEXPS, $file)
1579 18 3 if (exists $ignore_file_regexps{$file}) { }
1596 112 286 if /^#/ or length $_ == 0
1616 227 97 if (index($regexp, '/') == -1) { }
1628 29 9 @segment_regexps ? :
1630 37 0 @path_regexps ? :
1640 2 64 if $@
1672 3 5 if $path =~ /$prefix/
1696 1 0 if $path =~ /$regex/
1731 0 52 unless (@{$self->{'tasks'};})
1767 90 55 if ($task->{'action'} eq 'create') { }
53 2 elsif ($task->{'action'} eq 'remove') { }
2 0 elsif ($task->{'action'} eq 'move') { }
1768 19 71 if ($task->{'type'} eq 'dir') { }
71 0 elsif ($task->{'type'} eq 'link') { }
1769 0 19 unless mkdir $task->{'path'}, 511
1779 0 71 unless symlink $task->{'source'}, $task->{'path'}
1784 7 46 if ($task->{'type'} eq 'dir') { }
46 0 elsif ($task->{'type'} eq 'link') { }
1786 0 7 unless rmdir $task->{'path'}
1791 0 46 unless unlink $task->{'path'}
1796 2 0 if ($task->{'type'} eq "file")
1800 0 2 unless move($task->{'path'}, $task->{'dest'})
1828 2116 42 unless (exists $self->{'link_task_for'}{$path})
1834 0 42 unless $action eq "remove" or $action eq "create"
1860 627 32 unless (exists $self->{'dir_task_for'}{$path})
1866 0 32 unless $action eq "remove" or $action eq "create"
1896 9 1498 if (exists $self->{'link_task_for'}{$prefix} and $self->{'link_task_for'}{$prefix}{'action'} eq "remove")
1927 8 1413 if (my $action = $self->link_task_action($target_path))
1928 0 8 if ($action eq 'remove') { }
8 0 elsif ($action eq 'create') { }
1938 129 1284 if (-l $target_path)
1942 1 128 $self->parent_link_scheduled_for_removal($target_path) ? :
1970 0 64 if (my $action = $self->dir_task_action($target_path))
1971 0 0 if ($action eq 'remove') { }
0 0 elsif ($action eq 'create') { }
1979 0 64 if $self->parent_link_scheduled_for_removal($target_path)
1981 57 7 if (-d $target_path)
2014 21 574 if ($laction eq 'remove') { }
4 570 elsif ($laction eq 'create') { }
2015 0 21 if ($daction eq 'remove') { }
6 15 elsif ($daction eq 'create') { }
2030 4 0 if ($daction eq 'remove') { }
0 0 elsif ($daction eq 'create') { }
2046 0 570 if ($daction eq 'remove') { }
22 548 elsif ($daction eq 'create') { }
2057 8 540 if $self->parent_link_scheduled_for_removal($target_path)
2059 469 71 if (-e $target_path)
2089 8 133 if (my $action = $self->link_task_action($link)) { }
133 0 elsif (-l $link) { }
2092 8 0 if ($action eq 'create') { }
0 0 elsif ($action eq 'remove') { }
2103 0 133 unless my $link_dest = readlink $link
2134 9 72 if (exists $self->{'dir_task_for'}{$link_src})
2137 0 9 if ($task_ref->{'action'} eq 'create') { }
9 0 elsif ($task_ref->{'action'} eq 'remove') { }
2138 0 0 if ($task_ref->{'type'} eq "dir")
2154 2 79 if (exists $self->{'link_task_for'}{$link_src})
2157 0 2 if ($task_ref->{'action'} eq 'create') { }
2 0 elsif ($task_ref->{'action'} eq 'remove') { }
2158 0 0 if ($task_ref->{'source'} ne $link_dest) { }
2171 0 2 if ($task_ref->{'source'} eq $link_dest)
2220 8 49 if (exists $self->{'link_task_for'}{$file})
2222 0 8 if ($task_ref->{'action'} eq 'remove') { }
8 0 elsif ($task_ref->{'action'} eq 'create') { }
2238 0 49 if (exists $self->{'dir_task_for'}{$file} and $self->{'dir_task_for'}{$file} eq "create")
2249 0 49 unless my $source = readlink $file
2285 3 16 if (exists $self->{'link_task_for'}{$dir})
2288 0 3 if ($task_ref->{'action'} eq 'create') { }
3 0 elsif ($task_ref->{'action'} eq 'remove') { }
2303 0 19 if (exists $self->{'dir_task_for'}{$dir})
2306 0 0 if ($task_ref->{'action'} eq 'create') { }
0 0 elsif ($task_ref->{'action'} eq 'remove') { }
2356 0 9 if (exists $self->{'link_task_for'}{$dir})
2366 0 9 if (exists $self->{'dir_task_for'}{$dir})
2369 0 0 if ($task_ref->{'action'} eq 'remove') { }
0 0 elsif ($task_ref->{'action'} eq 'create') { }
2422 0 2 if (exists $self->{'link_task_for'}{$src}) { }
0 2 elsif (exists $self->{'dir_task_for'}{$src}) { }