Branch Coverage

blib/lib/Doit/Git.pm
Criterion Covered Total %
branch 149 200 74.5


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 ? :
82 11 11 if (defined $branch)
83 1 10 if ($branch =~ m[^refs/remotes/(.*)])
87 7 4 if (not defined $current_branch or $current_branch ne $branch)
88 4 3 if (eval { do { $self->system({'show_cwd', 1, 'quiet', $quiet}, ('git', 'checkout'), $branch); 1 } }) { }
100 5 6 if ($info{'detached'})
105 21 1 if ($refresh eq "always")
108 5 16 if ($status =~ />$/)
116 8 13 if ($switch_later)
118 5 3 unless ($has_changes)
122 1 7 unless (eval { do { $self->system({"show_cwd", 1, "quiet", $quiet}, ("git", "checkout"), $branch) } })
129 4 1 if ($commit_before and $self->git_get_commit_hash ne $commit_before || $self->git_current_branch ne $branch_before)
140 2 12 if (defined $branch)
141 1 1 if ($branch =~ m[^refs/remotes/[^/]+/(.*)])
146 1 13 if ($clone_opts)
160 21 38 if (not defined $untracked_files) { }
1 37 elsif (not $untracked_files =~ /^(normal|no)$/) { }
165 1 57 if %opts
173 0 57 unless my $fh = &_pipe_open(@cmd)
178 6 7 if (/^\?\?/) { }
184 8 5 if ($has_uncommitted)
185 1 7 if ($has_untracked) { }
3 4 elsif ($untracked_files eq 'no') { }
192 3 50 if ($has_uncommitted) { }
5 45 elsif ($has_untracked) { }
198 2 43 unless close $fh
204 0 48 unless my $fh = &_pipe_open(@cmd)
209 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/) { }
218 0 31 if (-f ".git/svn/.metadata")
222 0 0 if (open my $fh_remote, "$root_dir/.git/refs/remotes/trunk")
223 0 0 if (open my $fh_local, "$root_dir/.git/refs/heads/master")
226 0 0 if ($sha1_remote ne $sha1_local)
228 0 0 if (my $log_fh = &_pipe_open("git", "log", "--pretty=format:%H", "master..remotes/trunk"))
229 0 0 if (scalar readline $log_fh)
234 0 0 if (my $log_fh = &_pipe_open("git", "log", "--pretty=format:%H", "remotes/trunk..master"))
235 0 0 if (scalar readline $log_fh)
239 0 0 if ($remote_is_newer and $local_is_newer) { }
0 0 elsif ($remote_is_newer) { }
0 0 elsif ($local_is_newer) { }
261 1 61 if %opts
273 1 19 if %opts
276 3 16 defined $commit ? :
284 6 2 unless (defined $commit)
285 1 7 if %opts
290 0 6 unless my $fh = &_pipe_open(@cmd)
293 3 3 if (defined $first and $first ne "\n")
301 3 3 unless close $fh
311 1 10 if %opts
316 0 10 unless my $fh = &_pipe_open(@cmd)
320 1 6 if $ignore_untracked and /^\?\?/
324 2 8 unless close $fh
333 1 4 if %opts
336 1 1 -f "$git_root/.git/shallow" ? :
343 1 49 if %opts
349 47 0 if (open $fh, "<", "$git_root/.git/HEAD")
351 29 18 if ($this_head =~ m[refs/heads/(\S+)])
358 18 0 if ($fh = &_pipe_open(("git", "status")))
360 0 18 if (/^On branch (.*)/)
361 0 0 if ($info_ref)
366 18 0 if (/^.* detached at (.*)/)
367 10 8 if ($info_ref)
373 0 0 if (/^\#\ Not\ currently\ on\ any\ branch\./)
375 0 0 if (my $fh2 = &_pipe_open(('git', 'show-ref'))) { }
378 0 0 if (my($sha1, $ref) = $_ =~ m[^(\S+)\s+refs/remotes/(.*)$])
379 0 0 if ($sha1 eq $this_head)
380 0 0 if ($info_ref)
388 0 0 unless close $fh2
406 1 22 if %opts
407 1 21 if (defined $val and $unset)
414 2 19 if ($unset) { }
415 1 1 if ($@) { }
416 1 0 if ($@->{'exitcode'} == 1) { }
423 0 1 defined $val ? :
427 12 7 if (not defined $val) { }
430 6 1 if (not defined $old_val or $old_val ne $val) { }
446 0 5 if %opts
448 3 1 defined $method ? :
1 4 ref $method eq 'ARRAY' ? :
453 1 4 unless (@methods)
461 2 3 if ($method eq 'remote') { }
2 1 elsif ($method eq 'symbolic-ref') { }
464 2 0 if ($info_res =~ /^\s*HEAD branch:\s+(.*)/m) { }
473 2 0 if (defined $info_res and $info_res ne '') { }
485 0 4 if (@error_msgs)
497 0 2 unless opendir my $h, $dir
501 1 4 unless $entry =~ /^[.][.]?\z/
514 0 139 unless open $fh, "-|", @cmd