| 1 | 7 | ▶ | use 5.006; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | package Git::Wrapper; | ||||||||||||||||||||||||||||||||||||||||||
| 6 | #ABSTRACT: Wrap git(7) command-line interface | ||||||||||||||||||||||||||||||||||||||||||
| 7 | 7 | $Git::Wrapper::VERSION = '0.048_090'; # TRIAL | |||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 7 | $Git::Wrapper::VERSION = '0.048090';our $DEBUG=0; | |||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | # Prevent ANSI color with extreme prejudice | ||||||||||||||||||||||||||||||||||||||||||
| 12 | # https://github.com/genehack/Git-Wrapper/issues/13 | ||||||||||||||||||||||||||||||||||||||||||
| 13 | 7 | delete $ENV{GIT_PAGER_IN_USE}; | |||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 7 | ▶ | use File::chdir; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 7 | ▶ | use File::Temp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 7 | ▶ | use IPC::Run3 (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 7 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 7 | ▶ | use Sort::Versions; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 7 | ▶ | use Symbol; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 7 | ▶ | use Git::Wrapper::Exception; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 7 | ▶ | use Git::Wrapper::File::RawModification; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 7 | ▶ | use Git::Wrapper::Log; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 7 | ▶ | use Git::Wrapper::Statuses; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 9 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 9 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | # three calling conventions | ||||||||||||||||||||||||||||||||||||||||||
| 31 | # 1: my $gw = Git::Wrapper->new( $dir ) | ||||||||||||||||||||||||||||||||||||||||||
| 32 | # 2: my $gw = Git::Wrapper->new( $dir , %options ) | ||||||||||||||||||||||||||||||||||||||||||
| 33 | # 3: my $gw = Git::Wrapper->new({ dir => $dir , %options }); | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 9 | my $args; | |||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | 9 | ▶ | if ( scalar @_ == 1 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 7 | my $arg = shift; | |||||||||||||||||||||||||||||||||||||||||
| 39 | 7 | ▶ | if ( ref $arg eq 'HASH' ) { $args = $arg } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 2 | elsif ( blessed $arg ) { $args = { dir => "$arg" } } # my objects, let me | |||||||||||||||||||||||||||||||||||||||||
| 41 | # show you them. | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | elsif ( ! ref $arg ) { $args = { dir => $arg } } | |||||||||||||||||||||||||||||||||||||||||
| 43 | 2 | else { die "Single arg must be hashref, scalar, or stringify-able object" } | |||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||
| 45 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 2 | my( $dir , %opts ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 47 | 2 | ▶ | $dir = "$dir" if blessed $dir; # we can stringify it for you wholesale | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 2 | $args = { dir => $dir , %opts } | |||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 7 | my $self = bless $args => $class; | |||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 7 | ▶ | die "usage: $class->new(\$dir)" unless $self->dir; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 5 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 56 | ▶ | sub AUTOLOAD { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | 56 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 56 | (my $meth = our $AUTOLOAD) =~ s/.+:://; | |||||||||||||||||||||||||||||||||||||||||
| 62 | 56 | ▶ | return if $meth eq 'DESTROY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 49 | $meth =~ tr/_/-/; | |||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 49 | return $self->RUN($meth, @_); | |||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | sub ERR { shift->{err} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ERR: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | sub OUT { shift->{out} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
OUT: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | sub AUTOPRINT { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
AUTOPRINT: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | $self->{autoprint} = shift if @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | return $self->{autoprint}; | |||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | 181 | ▶ | sub RUN { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
RUN: called CC=11 SCAR=24.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 181 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | 181 | delete $self->{err}; | |||||||||||||||||||||||||||||||||||||||||
| 84 | 181 | delete $self->{out}; | |||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 181 | my $cmd = shift; | |||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 181 | my( $parts , $stdin ) = _parse_args( $cmd , @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | 181 | my @cmd = ( $self->git , @$parts ); | |||||||||||||||||||||||||||||||||||||||||
| 91 | 181 | my( @out , @err ); | |||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | { | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 181 | ▶ | local $CWD = $self->dir unless $cmd eq 'clone'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 181 | ▶ | print STDERR join(' ',@cmd),"\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | 181 | my ($stdout, $stderr); | |||||||||||||||||||||||||||||||||||||||||
| 99 | # Prevent commands from running interactively | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 181 | local $ENV{GIT_EDITOR} = ' '; | |||||||||||||||||||||||||||||||||||||||||
| 101 | 181 | IPC::Run3::run3(\@cmd, \$stdin, \$stdout, \$stderr); | |||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | @out = map { | ||||||||||||||||||||||||||||||||||||||||||
| 104 | 181 | chomp; | |||||||||||||||||||||||||||||||||||||||||
| 105 | 2284 | $_; | |||||||||||||||||||||||||||||||||||||||||
| 106 | } split(/\n/, $stdout); | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | @err = map { | ||||||||||||||||||||||||||||||||||||||||||
| 109 | 181 | chomp; | |||||||||||||||||||||||||||||||||||||||||
| 110 | 2082 | $_; | |||||||||||||||||||||||||||||||||||||||||
| 111 | } split(/\n/, $stderr); | ||||||||||||||||||||||||||||||||||||||||||
| 112 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 181 | ▶ | print "status: $?\n" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | # In earlier gits (1.5, 1.6, I'm not sure when it changed), "git status" | ||||||||||||||||||||||||||||||||||||||||||
| 117 | # would exit 1 if there was nothing to commit, or in other cases. This is | ||||||||||||||||||||||||||||||||||||||||||
| 118 | # basically insane, and has been fixed, but if we don't require git 1.7, we | ||||||||||||||||||||||||||||||||||||||||||
| 119 | # should cope with it. -- rjbs, 2012-03-31 | ||||||||||||||||||||||||||||||||||||||||||
| 120 | 181 | ▶ | my $stupid_status = $cmd eq 'status' && @out && ! @err; | ||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
$cmd eq 'status' && @out && !@err
$cmd eq "status" and @out
MC/DC66%2/3
$cmd eq 'status' && @out && !@err
$cmd eq "status"
@out
!@err
Truth table75%3/4
A and B && not(C)
A= $cmd eq "status"B= @outC= !@err
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | 181 | ▶ | if ($? && ! $stupid_status) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$? and not $stupid_status
MC/DC50%1/2
$? and not $stupid_status
$?
not $stupid_status
Truth table66%2/3
A and not(B)
A= $?B= not $stupid_status
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 1 | die Git::Wrapper::Exception->new( | |||||||||||||||||||||||||||||||||||||||||
| 124 | output => \@out, | ||||||||||||||||||||||||||||||||||||||||||
| 125 | error => \@err, | ||||||||||||||||||||||||||||||||||||||||||
| 126 | status => $? >> 8, | ||||||||||||||||||||||||||||||||||||||||||
| 127 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 180 | $self->{err} = \@err; | |||||||||||||||||||||||||||||||||||||||||
| 131 | 180 | $self->{out} = \@out; | |||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 180 | ▶ | if( $self->{autoprint} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | print $_, "\n" for @out; | |||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | warn $_, "\n" for @err; | |||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | 180 | return @out; | |||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | 1 | ▶ | sub branch { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
branch: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | 1 | ▶ | my $opt = ref $_[0] eq 'HASH' ? shift : {}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | 1 | $opt->{no_color} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | 1 | return $self->RUN(branch => $opt,@_); | |||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | 188 | ▶ | sub dir { shift->{dir} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dir: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 181 | ▶ | sub git { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
git: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | 181 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | 181 | ▶ | return $self->{git_binary} if defined $self->{git_binary}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | 179 | ▶ | return ( defined $ENV{GIT_WRAPPER_GIT} ) ? $ENV{GIT_WRAPPER_GIT} : 'git'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | sub has_git_in_path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_git_in_path: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | require IPC::Cmd; | |||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | IPC::Cmd::can_run('git'); | |||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 12 | ▶ | sub log { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
log: called CC=20 SCAR=30.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 12 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||
| 169 | 12 | ▶ | if ( grep /format=/, @_ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | 1 | die Git::Wrapper::Exception->new( | |||||||||||||||||||||||||||||||||||||||||
| 171 | error => [qw/--format not allowed. Use the RUN() method if you with to use a custom log format./], | ||||||||||||||||||||||||||||||||||||||||||
| 172 | output => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 173 | status => 255 , | ||||||||||||||||||||||||||||||||||||||||||
| 174 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | 11 | ▶ | my $opt = ref $_[0] eq 'HASH' ? shift : {}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 11 | $opt->{no_color} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 179 | 11 | $opt->{pretty} = 'medium'; | |||||||||||||||||||||||||||||||||||||||||
| 180 | 11 | $opt->{no_abbrev} = 1; # https://github.com/genehack/Git-Wrapper/issues/67 | |||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | 11 | ▶ | $opt->{no_abbrev_commit} = 1 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | if $self->supports_log_no_abbrev_commit; | ||||||||||||||||||||||||||||||||||||||||||
| 184 | 11 | ▶ | $opt->{no_expand_tabs} = 1 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | if $self->supports_log_no_expand_tabs; | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | 11 | ▶ | my $raw = defined $opt->{raw} && $opt->{raw}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
defined $opt->{'raw'} && $opt->{'raw'}
MC/DC50%1/2
defined $opt->{'raw'} && $opt->{'raw'}
defined $opt->{'raw'}
$opt->{'raw'}
Truth table66%2/3
A && B
A= defined $opt->{'raw'}B= $opt->{'raw'}
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | 11 | my @out = $self->RUN(log => $opt, @_); | |||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 11 | my @logs; | |||||||||||||||||||||||||||||||||||||||||
| 192 | 11 | ▶ | while (my $line = shift @out) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 14 | ▶ | die "unhandled: $line" unless $line =~ /^commit (\S+)/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | 13 | my $current = Git::Wrapper::Log->new($1); | |||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | 13 | $line = shift @out; # next line; | |||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | 13 | ▶ | while ($line =~ /^(\S+):\s+(.+)$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 26 | $current->attr->{lc $1} = $2; | |||||||||||||||||||||||||||||||||||||||||
| 201 | 26 | $line = shift @out; # next line; | |||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | 13 | ▶ | die "no blank line separating head from message" if $line; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||
| 206 | 13 | ▶ | my ( $initial_indent ) = $out[0] =~ /^(\s*)/ if @out; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | 13 | my $message = ''; | |||||||||||||||||||||||||||||||||||||||||
| 209 | 13 | ▶ | while ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
@out and not $out[0] =~ /^commit (\S+)/ and length($line = shift @out)
@out and not $out[0] =~ /^commit (\S+)/
MC/DC100%3/3
@out and not $out[0] =~ /^commit (\S+)/ and length($line = shift @out)
@out
not $out[0] =~ /^commit (\S+)/
length($line = shift @out)
Truth table100%4/4
A and not(B) and C
A= @outB= not $out[0] =~ /^commit (\S+)/C= length($line = shift @out)
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | @out | ||||||||||||||||||||||||||||||||||||||||||
| 211 | and $out[0] !~ /^commit (\S+)/ | ||||||||||||||||||||||||||||||||||||||||||
| 212 | and length($line = shift @out) | ||||||||||||||||||||||||||||||||||||||||||
| 213 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 214 | 20 | $line =~ s/^$initial_indent//; # strip just the indenting added by git | |||||||||||||||||||||||||||||||||||||||||
| 215 | 20 | $message .= "$line\n"; | |||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | 13 | $current->message($message); | |||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | 13 | ▶ | if ($raw) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | 3 | my @modifications; | |||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | # example outputs: | ||||||||||||||||||||||||||||||||||||||||||
| 224 | # regular: | ||||||||||||||||||||||||||||||||||||||||||
| 225 | # :000000 100644 0000000000000000000000000000000000000000 ce013625030ba8dba906f756967f9e9ca394464a A foo/bar | ||||||||||||||||||||||||||||||||||||||||||
| 226 | # with score value after file type (see https://github.com/genehack/Git-Wrapper/issues/70): | ||||||||||||||||||||||||||||||||||||||||||
| 227 | # :100644 100644 c659037... c659037... R100 foo bar | ||||||||||||||||||||||||||||||||||||||||||
| 228 | 3 | ▶ | while(@out and $out[0] =~ m/^\:(\d{6}) (\d{6}) (\w{40}) (\w{40}) (\w{1}[0-9]*)\t(.*)$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@out and $out[0] =~ /^\:(\d{6}) (\d{6}) (\w{40}) (\w{40}) (\w{1}[0-9]*)\t(.*)$/
MC/DC50%1/2
@out and $out[0] =~ /^\:(\d{6}) (\d{6}) (\w{40}) (\w{40}) (\w{1}[0-9]*)\t(.*)$/
@out
$out[0] =~ /^\:(\d{6}) (\d{6}) (\w{40}) (\w{40}) (\w{1}[0-9]*)\t(.*)$/
Truth table66%2/3
A and B
A= @outB= $out[0] =~ /^\:(\d{6}) (\d{6}) (\w{40}) (\w{40}) (\w{1}[0-9]*)\t(.*)$/
| |||||||||||||||||||||||||||||||||||||||||||
| 229 | 3 | push @modifications, Git::Wrapper::File::RawModification->new($6,$5,$1,$2,$3,$4); | |||||||||||||||||||||||||||||||||||||||||
| 230 | 3 | shift @out; | |||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 3 | ▶ | $current->modifications(@modifications) if @modifications; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | 13 | push @logs, $current; | |||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | 13 | ▶ | last unless @out; # handle running out of log | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | 3 | ▶ | shift @out unless $out[0] =~ /^commit/; # blank line at end of entry, except merge commits; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | 10 | return @logs; | |||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 7 | my %STATUS_CONFLICTS = map { $_ => 1 } qw<DD AU UD UA DU AA UU>; | |||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | 39 | ▶ | sub status { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
status: called CC=11 SCAR=24.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 39 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | 39 | ▶ | return $self->RUN('status' , @_ ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 250 | unless $self->supports_status_porcelain; | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | 39 | ▶ | my $opt = ref $_[0] eq 'HASH' ? shift : {}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 253 | 39 | $opt->{$_} = 1 for qw<porcelain>; | |||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | 39 | my @out = $self->RUN(status => $opt, @_); | |||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | 39 | my $statuses = Git::Wrapper::Statuses->new; | |||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | 39 | ▶ | return $statuses if !@out; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | 26 | for (@out) { | |||||||||||||||||||||||||||||||||||||||||
| 262 | 31 | my ($x, $y, $from, $to) = $_ =~ /\A(.)(.) (.*?)(?: -> (.*))?\z/; | |||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | 31 | ▶ | if ($STATUS_CONFLICTS{"$x$y"}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | $statuses->add('conflict', "$x$y", $from, $to); | |||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||
| 267 | ▶ | elsif ($x eq '?' && $y eq '?') { | |||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$x eq "?" and $y eq "?"
MC/DC50%1/2
$x eq "?" and $y eq "?"
$x eq "?"
$y eq "?"
Truth table66%2/3
A and B
A= $x eq "?"B= $y eq "?"
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | 10 | $statuses->add('unknown', '?', $from, $to); | |||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||
| 270 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 271 | 21 | ▶ | $statuses->add('changed', $y, $from, $to) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | if $y ne ' '; | ||||||||||||||||||||||||||||||||||||||||||
| 273 | 21 | ▶ | $statuses->add('indexed', $x, $from, $to) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | if $x ne ' '; | ||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||
| 277 | 26 | return $statuses; | |||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | 1 | ▶ | sub supports_hash_object_filters { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
supports_hash_object_filters: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||
| 283 | # The '--no-filters' option to 'git-hash-object' was added in version 1.6.1 | ||||||||||||||||||||||||||||||||||||||||||
| 284 | 1 | ▶ | return 0 if ( versioncmp( $self->version , '1.6.1' ) == -1 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 285 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | 12 | ▶ | sub supports_log_no_abbrev_commit { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
supports_log_no_abbrev_commit: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 289 | 12 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | # The '--no-abbrev-commit' option to 'git log' was added in version 1.7.6 | ||||||||||||||||||||||||||||||||||||||||||
| 292 | 12 | ▶ | return ( versioncmp( $self->version , '1.7.6' ) == -1 ) ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | 11 | ▶ | sub supports_log_no_expand_tabs { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
supports_log_no_expand_tabs: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 296 | 11 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | # The '--no-expand-tabs' option to git log was added in version 2.9.0 | ||||||||||||||||||||||||||||||||||||||||||
| 299 | 11 | ▶ | return 0 if ( versioncmp( $self->version , '2.9' ) == -1 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 300 | 11 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | 2 | ▶ | sub supports_log_raw_dates { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
supports_log_raw_dates: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 304 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | # The '--date=raw' option to 'git log' was added in version 1.6.2 | ||||||||||||||||||||||||||||||||||||||||||
| 307 | 2 | ▶ | return 0 if ( versioncmp( $self->version , '1.6.2' ) == -1 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 308 | 2 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||
| 311 | 41 | ▶ | sub supports_status_porcelain { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
supports_status_porcelain: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 312 | 41 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | # The '--porcelain' option to git status was added in version 1.7.0 | ||||||||||||||||||||||||||||||||||||||||||
| 315 | 41 | ▶ | return 0 if ( versioncmp( $self->version , '1.7' ) == -1 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | 41 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | 76 | ▶ | sub version { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
version: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | 76 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||
| 322 | 76 | my ($version) = $self->RUN('version'); | |||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | 76 | $version =~ s/^git version //; | |||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | 76 | return $version; | |||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | sub _message_tempfile { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_message_tempfile: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | my ( $message ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | my $tmp = File::Temp->new( UNLINK => 0 ); | |||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | $tmp->print( $message ); | |||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | return ( "file", '"'.$tmp->filename.'"' ); | |||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | 148 | ▶ | sub _opt_and_val { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_opt_and_val: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 339 | 148 | my( $name , $val ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | 148 | $name =~ tr/_/-/; | |||||||||||||||||||||||||||||||||||||||||
| 342 | 148 | ▶ | my $opt = length($name) == 1 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 343 | ? "-$name" | ||||||||||||||||||||||||||||||||||||||||||
| 344 | : "--$name" | ||||||||||||||||||||||||||||||||||||||||||
| 345 | ; | ||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | return | ||||||||||||||||||||||||||||||||||||||||||
| 348 | 148 | ▶ | $val eq '1' ? ($opt) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 349 | : length($name) == 1 ? ($opt, $val) | ||||||||||||||||||||||||||||||||||||||||||
| 350 | : "$opt=$val"; | ||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||
| 353 | 194 | ▶ | sub _parse_args { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_args: called CC=11 SCAR=24.4
| |||||||||||||||||||||||||||||||||||||||||||
| 354 | 194 | my $cmd = shift; | |||||||||||||||||||||||||||||||||||||||||
| 355 | 194 | ▶ | die "initial argument must not be a reference\n" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 356 | if ref $cmd; | ||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||
| 358 | 194 | my( $stdin , @pre_cmd , @post_cmd ); | |||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | 194 | foreach ( @_ ) { | |||||||||||||||||||||||||||||||||||||||||
| 361 | 159 | ▶ | if ( ref $_ eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 362 | $stdin = delete $_->{-STDIN} | ||||||||||||||||||||||||||||||||||||||||||
| 363 | 85 | ▶ | if exists $_->{-STDIN}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | 85 | for my $name ( sort keys %$_ ) { | |||||||||||||||||||||||||||||||||||||||||
| 366 | 148 | my $val = delete $_->{$name}; | |||||||||||||||||||||||||||||||||||||||||
| 367 | 148 | ▶ | next if $val eq '0'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||
| 369 | 148 | ▶ | if ( $name =~ s/^-// ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 370 | 10 | push @pre_cmd , _opt_and_val( $name , $val ); | |||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||
| 372 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 373 | 138 | ▶ | ( $name, $val ) = _message_tempfile( $val ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 374 | if _win32_multiline_commit_msg( $cmd, $name, $val ); | ||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | 138 | push @post_cmd , _opt_and_val( $name , $val ); | |||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||||||||
| 380 | elsif ( blessed $_ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 381 | 2 | push @post_cmd , "$_"; # here be anteaters | |||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||
| 383 | elsif ( ref $_ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | die "Git::Wrapper command arguments must be plain scalars, hashrefs, " | |||||||||||||||||||||||||||||||||||||||||
| 385 | . "or stringify-able objects.\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||||||||||||
| 387 | 72 | else { push @post_cmd , $_; } | |||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||
| 390 | 194 | return( [ @pre_cmd , $cmd , @post_cmd ] , $stdin ); | |||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||
| 393 | 138 | ▶ | sub _win32_multiline_commit_msg { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_win32_multiline_commit_msg: called CC=6 SCAR=32.6
| |||||||||||||||||||||||||||||||||||||||||||
| 394 | 138 | my ( $cmd, $name, $val ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | 138 | ▶ | return 0 if $^O ne "MSWin32"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | ▶ | return 0 if $cmd ne "commit"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | ▶ | return 0 if $name ne "m" and $name ne "message"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$name ne "m" and $name ne "message"
MC/DC0%0/2
$name ne "m" and $name ne "message"
$name ne "m"
$name ne "message"
Truth table0%0/3
A and B
A= $name ne "m"B= $name ne "message"
| |||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | ▶ | return 0 if $val !~ /\n/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | __END__ | ||||||||||||||||||||||||||||||||||||||||||