Branch Coverage

blib/lib/Doit/Git.pm
Criterion Covered Total %
branch 192 246 78.0


line true false branch
31 39 3 unless delete $opts{'repository_aliases'}
38 1 41 unless ($refresh =~ /^(always|never)$/)
40 1 40 if %opts
44 13 27 if (not -e $directory) { }
47 1 26 unless (-d $directory)
50 2 24 unless (-d "$directory/.git")
51 1 1 if (_is_dir_empty($directory)) { }
58 24 14 if (not $do_clone) { }
61 1 23 if (not defined $actual_repository) { }
66 3 20 if ($actual_repository ne $repository and not grep({$_ eq $actual_repository;} @repository_aliases))
68 1 2 if ($allow_remote_url_change) { }
72 1 1 @repository_aliases ? :
83 11 11 if (defined $branch)
84 1 10 if ($branch =~ m[^refs/remotes/(.*)])
88 7 4 if (not defined $current_branch or $current_branch ne $branch)
89 4 3 if (eval { do { $self->system({'show_cwd', 1, 'quiet', $quiet}, ('git', 'checkout'), $branch); 1 } }) { }
101 5 6 if ($info{'detached'})
106 21 1 if ($refresh eq "always")
109 5 16 if ($status =~ />$/)
117 8 13 if ($switch_later)
119 5 3 unless ($has_changes)
123 1 7 unless (eval { do { $self->system({"show_cwd", 1, "quiet", $quiet}, ("git", "checkout"), $branch) } })
130 4 1 if ($commit_before and $self->git_get_commit_hash ne $commit_before || $self->git_current_branch ne $branch_before)
141 2 12 if (defined $branch)
142 1 1 if ($branch =~ m[^refs/remotes/[^/]+/(.*)])
147 1 13 if ($clone_opts)
161 21 38 if (not defined $untracked_files) { }
1 37 elsif (not $untracked_files =~ /^(normal|no)$/) { }
166 1 57 if %opts
174 0 57 unless my $fh = &_pipe_open(@cmd)
179 6 7 if (/^\?\?/) { }
185 8 5 if ($has_uncommitted)
186 1 7 if ($has_untracked) { }
3 4 elsif ($untracked_files eq 'no') { }
193 3 50 if ($has_uncommitted) { }
5 45 elsif ($has_untracked) { }
199 2 43 unless close $fh
205 0 48 unless my $fh = &_pipe_open(@cmd)
210 4 44 if ($l =~ /^(# )?Your branch is ahead/) { }
9 35 elsif ($l =~ /^(# )?Your branch is behind/) { }
4 31 elsif ($l =~ /^(# )?Your branch and .* have diverged/) { }
219 0 31 if (-f ".git/svn/.metadata")
223 0 0 if (open my $fh_remote, "$root_dir/.git/refs/remotes/trunk")
224 0 0 if (open my $fh_local, "$root_dir/.git/refs/heads/master")
227 0 0 if ($sha1_remote ne $sha1_local)
229 0 0 if (my $log_fh = &_pipe_open("git", "log", "--pretty=format:%H", "master..remotes/trunk"))
230 0 0 if (scalar readline $log_fh)
235 0 0 if (my $log_fh = &_pipe_open("git", "log", "--pretty=format:%H", "remotes/trunk..master"))
236 0 0 if (scalar readline $log_fh)
240 0 0 if ($remote_is_newer and $local_is_newer) { }
0 0 elsif ($remote_is_newer) { }
0 0 elsif ($local_is_newer) { }
262 1 64 if %opts
274 1 19 if %opts
277 3 16 defined $commit ? :
285 6 2 unless (defined $commit)
286 1 7 if %opts
291 0 6 unless my $fh = &_pipe_open(@cmd)
294 3 3 if (defined $first and $first ne "\n")
302 3 3 unless close $fh
312 1 10 if %opts
317 0 10 unless my $fh = &_pipe_open(@cmd)
321 1 6 if $ignore_untracked and /^\?\?/
325 2 8 unless close $fh
334 1 4 if %opts
337 1 1 -f "$git_root/.git/shallow" ? :
344 1 52 if %opts
350 50 0 if (open $fh, "<", "$git_root/.git/HEAD")
352 32 18 if ($this_head =~ m[refs/heads/(\S+)])
359 18 0 if ($fh = &_pipe_open(("git", "status")))
361 0 18 if (/^On branch (.*)/)
362 0 0 if ($info_ref)
367 18 0 if (/^.* detached at (.*)/)
368 10 8 if ($info_ref)
374 0 0 if (/^\#\ Not\ currently\ on\ any\ branch\./)
376 0 0 if (my $fh2 = &_pipe_open(('git', 'show-ref'))) { }
379 0 0 if (my($sha1, $ref) = $_ =~ m[^(\S+)\s+refs/remotes/(.*)$])
380 0 0 if ($sha1 eq $this_head)
381 0 0 if ($info_ref)
389 0 0 unless close $fh2
409 1 50 if %opts
410 1 49 if ($all and defined $val)
413 6 43 if ($add)
414 1 5 if ($unset)
417 1 4 unless (defined $val)
420 1 3 if (ref $val eq "ARRAY")
424 7 39 if (ref $val eq "ARRAY")
425 2 5 if (@$val == 0)
433 30 16 defined $ret ? :
434 10 36 if ($unset) { }
435 3 7 if ($@) { }
436 3 0 if ($@->{'exitcode'} == 1) { }
443 2 5 if ($all) { }
444 2 0 if (@old_vals) { }
453 3 2 if (defined $val) { }
2 0 elsif (@old_vals) { }
455 2 4 if ($val eq $old_vals[$i])
466 4 1 if ($do_unset) { }
468 2 2 defined $val ? :
470 1 3 if ($@)
471 1 0 if ($@->{'exitcode'} == 5) { }
472 0 1 if (@old_vals <= 1) { }
489 21 15 if (not defined $val) { }
490 7 14 if ($all) { }
496 5 10 if (ref $val eq 'ARRAY') { }
498 2 3 unless ($do_set)
500 1 2 if ($old_vals[$i] ne $val->[$i])
506 4 1 if ($do_set) { }
518 3 6 if ($val eq $old_vals[$i])
523 7 3 if ($do_set) { }
524 1 6 $add ? :
540 0 5 if %opts
542 3 1 defined $method ? :
1 4 ref $method eq 'ARRAY' ? :
547 1 4 unless (@methods)
555 2 3 if ($method eq 'remote') { }
2 1 elsif ($method eq 'symbolic-ref') { }
558 2 0 if ($info_res =~ /^\s*HEAD branch:\s+(.*)/m) { }
567 2 0 if (defined $info_res and $info_res ne '') { }
579 0 4 if (@error_msgs)
591 0 2 unless opendir my $h, $dir
595 1 4 unless $entry =~ /^[.][.]?\z/
608 0 139 unless open $fh, "-|", @cmd