Branch Coverage

blib/lib/Doit/Git.pm
Criterion Covered Total %
branch 131 178 73.6


line true false branch
31 36 3 unless delete $opts{'repository_aliases'}
38 1 38 unless ($refresh =~ /^(always|never)$/)
40 1 37 if %opts
44 12 25 if (not -e $directory) { }
47 1 24 unless (-d $directory)
50 2 22 unless (-d "$directory/.git")
51 1 1 if (_is_dir_empty($directory)) { }
58 22 13 if (not $do_clone) { }
61 1 21 if (not defined $actual_repository) { }
66 3 18 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 9 11 if (defined $branch)
84 5 4 if (not defined $current_branch or $current_branch ne $branch)
85 2 3 if (eval { do { $self->system({'show_cwd', 1, 'quiet', $quiet}, ('git', 'checkout'), $branch); 1 } }) { }
97 3 6 if ($info{'detached'})
102 19 1 if ($refresh eq 'always')
105 5 14 if ($status =~ />$/)
113 6 13 if ($switch_later)
115 5 1 unless ($has_changes)
119 1 5 unless (eval { do { $self->system({'show_cwd', 1, 'quiet', $quiet}, ('git', 'checkout'), $branch) } })
126 4 1 if ($commit_before and $self->git_get_commit_hash ne $commit_before || $self->git_current_branch ne $branch_before)
137 1 12 if (defined $branch)
140 1 12 if ($clone_opts)
154 21 36 if (not defined $untracked_files) { }
1 35 elsif (not $untracked_files =~ /^(normal|no)$/) { }
159 1 55 if %opts
167 0 55 unless my $fh = &_pipe_open(@cmd)
172 6 7 if (/^\?\?/) { }
178 8 5 if ($has_uncommitted)
179 1 7 if ($has_untracked) { }
3 4 elsif ($untracked_files eq 'no') { }
186 3 48 if ($has_uncommitted) { }
5 43 elsif ($has_untracked) { }
192 2 41 unless close $fh
198 0 46 unless my $fh = &_pipe_open(@cmd)
203 4 42 if ($l =~ /^(# )?Your branch is ahead/) { }
9 33 elsif ($l =~ /^(# )?Your branch is behind/) { }
4 29 elsif ($l =~ /^(# )?Your branch and .* have diverged/) { }
212 0 29 if (-f '.git/svn/.metadata')
216 0 0 if (open my $fh_remote, "$root_dir/.git/refs/remotes/trunk")
217 0 0 if (open my $fh_local, "$root_dir/.git/refs/heads/master")
220 0 0 if ($sha1_remote ne $sha1_local)
222 0 0 if (my $log_fh = &_pipe_open('git', 'log', '--pretty=format:%H', 'master..remotes/trunk'))
223 0 0 if (scalar readline $log_fh)
228 0 0 if (my $log_fh = &_pipe_open('git', 'log', '--pretty=format:%H', 'remotes/trunk..master'))
229 0 0 if (scalar readline $log_fh)
233 0 0 if ($remote_is_newer and $local_is_newer) { }
0 0 elsif ($remote_is_newer) { }
0 0 elsif ($local_is_newer) { }
255 1 54 if %opts
267 1 19 if %opts
270 3 16 defined $commit ? :
278 6 2 unless (defined $commit)
279 1 7 if %opts
284 0 6 unless my $fh = &_pipe_open(@cmd)
287 3 3 if (defined $first and $first ne "\n")
295 3 3 unless close $fh
305 1 10 if %opts
310 0 10 unless my $fh = &_pipe_open(@cmd)
314 1 6 if $ignore_untracked and /^\?\?/
318 2 8 unless close $fh
327 1 4 if %opts
330 1 1 -f "$git_root/.git/shallow" ? :
337 1 42 if %opts
343 40 0 if (open $fh, '<', "$git_root/.git/HEAD")
345 27 13 if ($this_head =~ m[refs/heads/(\S+)])
352 13 0 if ($fh = &_pipe_open(('git', 'status')))
354 0 13 if (/^On branch (.*)/)
355 0 0 if ($info_ref)
360 13 0 if (/^.* detached at (.*)/)
361 7 6 if ($info_ref)
367 0 0 if (/^\#\ Not\ currently\ on\ any\ branch\./)
369 0 0 if (my $fh2 = &_pipe_open(('git', 'show-ref'))) { }
372 0 0 if (my($sha1, $ref) = $_ =~ m[^(\S+)\s+refs/remotes/(.*)$])
373 0 0 if ($sha1 eq $this_head)
374 0 0 if ($info_ref)
382 0 0 unless close $fh2
400 1 22 if %opts
401 1 21 if (defined $val and $unset)
408 2 19 if ($unset) { }
409 1 1 if ($@) { }
410 1 0 if ($@->{'exitcode'} == 1) { }
417 0 1 defined $val ? :
421 12 7 if (not defined $val) { }
424 6 1 if (not defined $old_val or $old_val ne $val) { }
439 0 2 unless opendir my $h, $dir
443 1 4 unless $entry =~ /^[.][.]?\z/
456 0 130 unless open $fh, '-|', @cmd