« blib/lib/Langertha/Holmgang/Sim/Linux/Storage.pm
↑ Summary
blib/lib/Langertha/Holmgang/Sim/Linux/Postgres.pm »
| 1 | package Langertha::Holmgang::Sim::Linux::Git; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: git on simulated Linux hosts — working copy, index, commits, push to a Forgejo server with hooks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Digest::SHA (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use Encode (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use JSON::MaybeXS (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | our $VERSION = '0.001'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | our @GAPS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | our $CWD; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 2 | my $J = JSON::MaybeXS->new( canonical => 1, utf8 => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 158 | ▶ | sub _clone { my $j = JSON::MaybeXS->new( canonical => 1 ); return $j->decode( $j->encode( $_[0] ) ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_clone: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 2 | my @DAY = qw( Thu Fri Sat Sun Mon Tue Wed ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # --- Repos, Baeume, Commits ------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 145 | ▶ | sub _repo_at { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_repo_at: called CC=8 SCAR=21.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 145 | my ( $dev, $path ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 145 | ▶ | my $rs = ( $dev->{git} || {} )->{repos} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%4/4
($$dev{'git'} || {})->{'repos'} || {}
$$dev{'git'} || {}
MC/DC100%1/1
($$dev{'git'} || {})->{'repos'} || {}
$$dev{'git'}
Truth table100%2/2
A
A= $$dev{'git'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 145 | ▶ | return () unless defined $path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 145 | ▶ | $path =~ s{/+\z}{} unless $path eq '/'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | for my $root ( sort { length $b <=> length $a } keys %$rs ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 141 | ▶ | return ( $root, $rs->{$root} ) if $path eq $root || index( $path, "$root/" ) == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$path eq $root or index($path, "$root/") == 0
MC/DC50%1/2
$path eq $root or index($path, "$root/") == 0
$path eq $root
index($path, "$root/") == 0
Truth table66%2/3
A or B
A= $path eq $rootB= index($path, "$root/") == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 5 | return (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 254 | ▶ | sub _text { my ($e) = @_; return ref $e eq 'HASH' ? $e->{content} // '' : $e } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_text: called CC=3 SCAR=14.2
Branch: 1 branch
Condition0%0/2
$$e{"content"} // ""
MC/DC0%0/1
$$e{"content"} // ""
$$e{"content"}
Truth table0%0/2
A
A= $$e{"content"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | # Arbeitsbaum: Dateien des Geraets unter dem Repo (relativ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 55 | ▶ | sub _work { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_work: called CC=7 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 55 | my ( $dev, $root ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 55 | my %w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 55 | ▶ | for my $p ( keys %{ $dev->{files} || {} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$dev{'files'} || {}
MC/DC0%0/1
$$dev{'files'} || {}
$$dev{'files'}
Truth table50%1/2
A
A= $$dev{'files'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 254 | ▶ | next unless index( $p, "$root/" ) == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 254 | my $rel = substr( $p, length($root) + 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 254 | ▶ | next if $rel =~ m{\A\.git(?:/|\z)}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 254 | my $e = $dev->{files}{$p}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 254 | ▶ | next if ref $e eq 'HASH' && defined $e->{link}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $e eq "HASH" and defined $$e{"link"}
MC/DC0%0/2
ref $e eq "HASH" and defined $$e{"link"}
ref $e eq "HASH"
defined $$e{"link"}
Truth table33%1/3
A and B
A= ref $e eq "HASH"B= defined $$e{"link"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 254 | $w{$rel} = _text($e); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 55 | return \%w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 18 | ▶ | sub _set_work { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_set_work: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 18 | my ( $dev, $root, $old, $new ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 18 | ▶ | for my $rel ( keys %$old ) { delete $dev->{files}{"$root/$rel"} unless exists $new->{$rel} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 18 | for my $rel ( keys %$new ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 81 | my $p = "$root/$rel"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 81 | my $e = $dev->{files}{$p}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | if ( ref $e eq 'HASH' ) { $e->{content} = $new->{$rel} } else { $dev->{files}{$p} = $new->{$rel} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 18 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 39 | ▶ | sub _ignore_res { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ignore_res: called CC=7 SCAR=21.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 39 | my ($tree) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 39 | my @re; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 39 | ▶ | for my $l ( split /\n/, $tree->{'.gitignore'} // '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$tree{".gitignore"} // ""
MC/DC0%0/1
$$tree{".gitignore"} // ""
$$tree{".gitignore"}
Truth table50%1/2
A
A= $$tree{".gitignore"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 41 | $l =~ s/\s+\z//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 41 | ▶ | next if $l eq '' || $l =~ /\A#/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$l eq "" or $l =~ /\A#/
MC/DC0%0/2
$l eq "" or $l =~ /\A#/
$l eq ""
$l =~ /\A#/
Truth table33%1/3
A or B
A= $l eq ""B= $l =~ /\A#/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 41 | my $anch = $l =~ s{\A/}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 41 | my $dir = $l =~ s{/\z}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 41 | ( my $re = quotemeta $l ) =~ s/\\\*\\\*/.*/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 41 | $re =~ s/\\\*/[^\/]*/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 41 | $re =~ s/\\\?/[^\/]/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 41 | ▶ | push @re, $anch || $l =~ m{/} ? qr{\A$re(?:/|\z)} : qr{(?:\A|/)$re(?:/|\z)}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$anch or $l =~ m[/]
MC/DC0%0/2
$anch or $l =~ m[/]
$anch
$l =~ m[/]
Truth table33%1/3
A or B
A= $anchB= $l =~ m[/]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 39 | return @re; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 14 | ▶ | sub _ignored { my ( $res, $rel ) = @_; return scalar grep { $rel =~ $_ } @$res } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ignored: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 13 | ▶ | sub _cid { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cid: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 13 | my ($c) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 13 | return Digest::SHA::sha1_hex( $J->encode( [ $c->{parents}, $c->{message}, $c->{author}, $c->{date}, $c->{tree} ] ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 133 | ▶ | sub _head { my ($r) = @_; return defined $r->{branch} ? ( $r->{refs}{heads} || {} )->{ $r->{branch} } : $r->{detached} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_head: called CC=3 SCAR=12.0
Branch: 1 branch
Condition50%1/2
$$r{'refs'}{'heads'} || {}
MC/DC0%0/1
$$r{'refs'}{'heads'} || {}
$$r{'refs'}{'heads'}
Truth table50%1/2
A
A= $$r{'refs'}{'heads'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 131 | ▶ | sub _tree { my ( $r, $id ) = @_; return defined $id && $r->{commits}{$id} ? $r->{commits}{$id}{tree} : {} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tree: called CC=3 SCAR=13.1
Branch: 1 branch
Condition33%1/3
defined $id and $$r{"commits"}{$id}
MC/DC0%0/2
defined $id and $$r{"commits"}{$id}
defined $id
$$r{"commits"}{$id}
Truth table33%1/3
A and B
A= defined $idB= $$r{"commits"}{$id}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 56 | ▶ | sub _index { my ($r) = @_; return $r->{index} // _clone( _tree( $r, _head($r) ) ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_index: called CC=2 SCAR=7.1
Condition66%2/3
$$r{"index"} // _clone(_tree($r, _head($r)))
MC/DC0%0/2
$$r{"index"} // _clone(_tree($r, _head($r)))
$$r{"index"}
_clone(_tree($r, _head($r)))
Truth table66%2/3
A // B
A= $$r{"index"}B= _clone(_tree($r, _head($r)))
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 37 | ▶ | sub _ancestors { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ancestors: called CC=5 SCAR=16.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 37 | my ( $r, $id ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 37 | my %s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 37 | my @q = grep {defined} ($id); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 37 | ▶ | while (@q) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 107 | my $x = shift @q; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 107 | ▶ | next if $s{$x}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 107 | ▶ | push @q, @{ ( $r->{commits}{$x} || {} )->{parents} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
($$r{'commits'}{$x} || {})->{'parents'} || []
$$r{'commits'}{$x} || {}
MC/DC0%0/1
($$r{'commits'}{$x} || {})->{'parents'} || []
$$r{'commits'}{$x}
Truth table50%1/2
A
A= $$r{'commits'}{$x}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 37 | return \%s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | # Commits von $from (ausschliesslich) bis $to, aelteste zuerst (nur erste Eltern) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 45 | ▶ | sub _range { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_range: called CC=7 SCAR=19.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 45 | my ( $r, $from, $to ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 45 | ▶ | my $ex = defined $from ? _ancestors( $r, $from ) : {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 45 | my @l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | my %seen; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 45 | my @q = grep {defined} ($to); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 45 | ▶ | while (@q) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 125 | my $x = shift @q; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 125 | ▶ | next if $seen{$x}++ || $ex->{$x}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$seen{$x}++ or $$ex{$x}
MC/DC50%1/2
$seen{$x}++ or $$ex{$x}
$seen{$x}++
$$ex{$x}
Truth table66%2/3
A or B
A= $seen{$x}++B= $$ex{$x}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 114 | push @l, $x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 114 | ▶ | push @q, @{ ( $r->{commits}{$x} || {} )->{parents} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
($$r{'commits'}{$x} || {})->{'parents'} || []
$$r{'commits'}{$x} || {}
MC/DC0%0/1
($$r{'commits'}{$x} || {})->{'parents'} || []
$$r{'commits'}{$x}
Truth table50%1/2
A
A= $$r{'commits'}{$x}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 45 | return sort { _order( $r, $a, $b ) } @l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | # aelter zuerst: nach Datum, dann nach Reihenfolge des Anlegens | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 94 | ▶ | sub _order { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_order: called CC=7 SCAR=28.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 94 | my ( $r, $x, $y ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 94 | my ( $p, $q ) = ( $r->{commits}{$x}, $r->{commits}{$y} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 94 | ▶ | return ( $p->{date} // 0 ) <=> ( $q->{date} // 0 ) || ( $p->{seq} // 0 ) <=> ( $q->{seq} // 0 ) || $x cmp $y; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition28%4/14
($$p{'date'} // 0) <=> ($$q{'date'} // 0) || ($$p{'seq'} // 0) <=> ($$q{'seq'} // 0) || $x cmp $y
($$p{"date"} // 0) <=> ($$q{"date"} // 0) or ($$p{"seq"} // 0) <=> ($$q{"seq"} // 0)
$$p{"date"} // 0
$$q{"date"} // 0
$$p{"seq"} // 0
$$q{"seq"} // 0
MC/DC0%0/3
($$p{'date'} // 0) <=> ($$q{'date'} // 0) || ($$p{'seq'} // 0) <=> ($$q{'seq'} // 0) || $x cmp $y
$$p{"date"}
$$p{"seq"}
$x cmp $y
MC/DC0%0/1
$$q{"date"} // 0
$$q{"date"}
MC/DC0%0/1
$$q{"seq"} // 0
$$q{"seq"}
Truth table25%1/4
A or B || C
A= $$p{"date"}B= $$p{"seq"}C= $x cmp $y
Truth table50%1/2
A
A= $$q{"date"}
Truth table0%0/2
A
A= $$q{"seq"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | # neueste zuerst (eigene Funktion: in den Befehlen ist $a das Argument-Array) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 4 | ▶ | sub _newest_first { my ( $r, @ids ) = @_; return reverse sort { _order( $r, $a, $b ) } @ids } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_newest_first: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 8 | ▶ | sub _who { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_who: called CC=7 SCAR=19.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 8 | my ( $dev, $r ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 8 | ▶ | my %c = ( %{ ( $dev->{git} || {} )->{config} || {} }, %{ $r->{config} || {} } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
($$dev{'git'} || {})->{'config'} || {}
$$dev{'git'} || {}
$$r{'config'} || {}
MC/DC100%1/1
($$dev{'git'} || {})->{'config'} || {}
$$dev{'git'}
MC/DC0%0/1
$$r{'config'} || {}
$$r{'config'}
Truth table100%2/2
A
A= $$dev{'git'}
Truth table50%1/2
A
A= $$r{'config'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 8 | ▶ | my $host = $dev->{hostname} // 'localhost'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$dev{"hostname"} // "localhost"
MC/DC0%0/1
$$dev{"hostname"} // "localhost"
$$dev{"hostname"}
Truth table50%1/2
A
A= $$dev{"hostname"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 8 | ▶ | return ( $c{'user.name'} // 'root' ) . ' <' . ( $c{'user.email'} // "root\@$host" ) . '>'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%4/4
$c{"user.name"} // "root"
$c{"user.email"} // "root\@$host"
MC/DC100%1/1
$c{"user.name"} // "root"
$c{"user.name"}
MC/DC100%1/1
$c{"user.email"} // "root\@$host"
$c{"user.email"}
Truth table100%2/2
A
A= $c{"user.name"}
Truth table100%2/2
A
A= $c{"user.email"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 7 | ▶ | sub _date { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_date: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 7 | my ($dev) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 7 | my $n = ++$dev->{git}{_clock}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 7 | my $t = 1792832400 + 60 * $n; # 2026-10-24 09:00 UTC, je Commit eine Minute | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 7 | return $t; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 3 | ▶ | sub _date_text { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_date_text: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 3 | my ($t) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 3 | my @g = gmtime( $t + 7200 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 3 | my @mon = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 3 | return sprintf '%s %s %d %02d:%02d:%02d %d +0200', $DAY[ int( ( $t + 7200 ) / 86400 ) % 7 ], $mon[ $g[4] ], $g[3], @g[ 2, 1, 0 ], $g[5] + 1900; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 10 | ▶ | sub _mk_commit { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mk_commit: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 10 | my ( $dev, $r, %c ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 10 | ▶ | $c{date} //= _date($dev); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$c{"date"} //= _date($dev)
MC/DC0%0/2
$c{"date"} //= _date($dev)
$c{"date"}
_date($dev)
Truth table66%2/3
A //= B
A= $c{"date"}B= _date($dev)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 10 | my $id = _cid( \%c ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 10 | $c{seq} = ++$dev->{git}{_seq}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 10 | $r->{commits}{$id} = \%c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 10 | return $id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 24 | ▶ | sub _subject { my ($m) = @_; my ($s) = split /\n/, $m // ''; return $s // '' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_subject: called CC=3 SCAR=11.7
Condition50%2/4
$m // ""
$s // ""
MC/DC0%0/1
$m // ""
$m
MC/DC0%0/1
$s // ""
$s
Truth table50%1/2
A
A= $m
Truth table50%1/2
A
A= $s
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 60 | ▶ | sub _short { return substr( $_[0] // '', 0, 7 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_short: called CC=2 SCAR=7.6
Condition50%1/2
$_[0] // ""
MC/DC0%0/1
$_[0] // ""
$_[0]
Truth table50%1/2
A
A= $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | # Revision -> Commit-ID oder undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 30 | ▶ | sub _rev { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_rev: called CC=30 SCAR=45.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 30 | my ( $r, $spec ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 30 | ▶ | return undef unless defined $spec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 30 | my ( $base, $ops ) = $spec =~ /\A(.*?)((?:[~^]\d*)*)\z/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 30 | ▶ | $base = 'HEAD' if $base eq '' || $base eq '@'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$base eq "" or $base eq "\@"
MC/DC0%0/2
$base eq "" or $base eq "\@"
$base eq ""
$base eq "\@"
Truth table33%1/3
A or B
A= $base eq ""B= $base eq "\@"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 30 | my $id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 30 | ▶ | if ( $base eq 'HEAD' ) { $id = _head($r) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | elsif ( $base =~ /\A(.+)\@\{u(?:pstream)?\}\z/ || $base eq '@{u}' ) { my $b = $1 // $r->{branch}; $id = ( $r->{refs}{remotes} || {} )->{"origin/$b"} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition12%1/8
$base =~ /\A(.+)\@\{u(?:pstream)?\}\z/ or $base eq "\@{u}"
$1 // $$r{"branch"}
$$r{'refs'}{'remotes'} || {}
MC/DC0%0/2
$base =~ /\A(.+)\@\{u(?:pstream)?\}\z/ or $base eq "\@{u}"
$base =~ /\A(.+)\@\{u(?:pstream)?\}\z/
$base eq "\@{u}"
MC/DC0%0/2
$1 // $$r{"branch"}
$1
$$r{"branch"}
MC/DC0%0/1
$$r{'refs'}{'remotes'} || {}
$$r{'refs'}{'remotes'}
Truth table33%1/3
A or B
A= $base =~ /\A(.+)\@\{u(?:pstream)?\}\z/B= $base eq "\@{u}"
Truth table0%0/3
A // B
A= $1B= $$r{"branch"}
Truth table0%0/2
A
A= $$r{'refs'}{'remotes'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 10 | ▶ | elsif ( exists( ( $r->{refs}{heads} || {} )->{$base} ) ) { $id = $r->{refs}{heads}{$base} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{'refs'}{'heads'} || {}
MC/DC0%0/1
$$r{'refs'}{'heads'} || {}
$$r{'refs'}{'heads'}
Truth table50%1/2
A
A= $$r{'refs'}{'heads'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 4 | ▶ | elsif ( exists( ( $r->{refs}{remotes} || {} )->{$base} ) ) { $id = $r->{refs}{remotes}{$base} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$$r{'refs'}{'remotes'} || {}
MC/DC100%1/1
$$r{'refs'}{'remotes'} || {}
$$r{'refs'}{'remotes'}
Truth table100%2/2
A
A= $$r{'refs'}{'remotes'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | elsif ( $base =~ m{\Aremotes/(.+)\z} && exists( ( $r->{refs}{remotes} || {} )->{$1} ) ) { $id = $r->{refs}{remotes}{$1} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition20%1/5
$base =~ m[\Aremotes/(.+)\z] and exists(($$r{"refs"}{"remotes"} || {})->{$1})
$$r{'refs'}{'remotes'} || {}
MC/DC0%0/2
$base =~ m[\Aremotes/(.+)\z] and exists(($$r{"refs"}{"remotes"} || {})->{$1})
$base =~ m[\Aremotes/(.+)\z]
$$r{'refs'}{'remotes'}
Truth table33%1/3
A and B
A= $base =~ m[\Aremotes/(.+)\z]B= $$r{'refs'}{'remotes'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 1 | ▶ | elsif ( exists( ( $r->{refs}{tags} || {} )->{$base} ) ) { $id = $r->{refs}{tags}{$base}{commit} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{'refs'}{'tags'} || {}
MC/DC0%0/1
$$r{'refs'}{'tags'} || {}
$$r{'refs'}{'tags'}
Truth table50%1/2
A
A= $$r{'refs'}{'tags'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | elsif ( $base =~ /\A[0-9a-f]{4,40}\z/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 3 | ▶ | my @m = grep { index( $_, $base ) == 0 } keys %{ $r->{commits} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{'commits'} || {}
MC/DC0%0/1
$$r{'commits'} || {}
$$r{'commits'}
Truth table50%1/2
A
A= $$r{'commits'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 3 | ▶ | $id = $m[0] if @m == 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 30 | ▶ | return undef unless defined $id; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 30 | ▶ | while ( $ops =~ /\G([~^])(\d*)/gc ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 1 | ▶ | my ( $o, $n ) = ( $1, length $2 ? $2 : 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 1 | ▶ | if ( $o eq '~' ) { for ( 1 .. $n ) { $id = ( $r->{commits}{$id}{parents} || [] )->[0] // return undef } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%2/4
($$r{"commits"}{$id}{"parents"} || [])->[0] // (return undef)
$$r{'commits'}{$id}{'parents'} || []
MC/DC0%0/1
($$r{"commits"}{$id}{"parents"} || [])->[0] // (return undef)
$$r{'commits'}{$id}{'parents'}
Truth table50%1/2
A
A= $$r{'commits'}{$id}{'parents'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | else { $id = ( $r->{commits}{$id}{parents} || [] )->[ $n - 1 ] // return undef } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
($$r{"commits"}{$id}{"parents"} || [])->[$n - 1] // (return undef)
$$r{'commits'}{$id}{'parents'} || []
MC/DC0%0/1
($$r{"commits"}{$id}{"parents"} || [])->[$n - 1] // (return undef)
$$r{'commits'}{$id}{'parents'}
Truth table0%0/2
A
A= $$r{'commits'}{$id}{'parents'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 30 | return $id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | # --- Ausgabe von Unterschieden ------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 4 | ▶ | sub _lines { my ($t) = @_; return () unless defined $t && length $t; return split /\n/, $t, -1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_lines: called CC=3 SCAR=11.0
Branch: 1 branch
Condition66%2/3
defined $t and length $t
MC/DC50%1/2
defined $t and length $t
defined $t
length $t
Truth table66%2/3
A and B
A= defined $tB= length $t
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 2 | ▶ | sub _udiff { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_udiff: called CC=23 SCAR=34.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 2 | my ( $path, $old, $new ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 2 | my @a = _lines($old); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 2 | my @b = _lines($new); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 2 | ▶ | pop @a if @a && $a[-1] eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@a and $a[-1] eq ""
MC/DC50%1/2
@a and $a[-1] eq ""
@a
$a[-1] eq ""
Truth table66%2/3
A and B
A= @aB= $a[-1] eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 2 | ▶ | pop @b if @b && $b[-1] eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@b and $b[-1] eq ""
MC/DC0%0/2
@b and $b[-1] eq ""
@b
$b[-1] eq ""
Truth table33%1/3
A and B
A= @bB= $b[-1] eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | # LCS (kleine Dateien) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 2 | my @L = map { [ (0) x ( @b + 1 ) ] } 0 .. @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 2 | ▶ | for my $i ( reverse 0 .. $#a ) { for my $j ( reverse 0 .. $#b ) { $L[$i][$j] = $a[$i] eq $b[$j] ? $L[ $i + 1 ][ $j + 1 ] + 1 : $L[ $i + 1 ][$j] > $L[$i][ $j + 1 ] ? $L[ $i + 1 ][$j] : $L[$i][ $j + 1 ] } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 2 | my ( $i, $j, @o ) = ( 0, 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 2 | ▶ | while ( $i < @a || $j < @b ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$i < @a or $j < @b
MC/DC100%2/2
$i < @a or $j < @b
$i < @a
$j < @b
Truth table100%3/3
A or B
A= $i < @aB= $j < @b
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | if ( $i < @a && $j < @b && $a[$i] eq $b[$j] ) { push @o, " $a[$i]"; $i++; $j++ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%4/6
$i < @a and $j < @b and $a[$i] eq $b[$j]
$i < @a and $j < @b
MC/DC0%0/3
$i < @a and $j < @b and $a[$i] eq $b[$j]
$i < @a
$j < @b
$a[$i] eq $b[$j]
Truth table50%2/4
A and B and C
A= $i < @aB= $j < @bC= $a[$i] eq $b[$j]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 2 | ▶ | elsif ( $j < @b && ( $i >= @a || $L[$i][ $j + 1 ] > $L[ $i + 1 ][$j] ) ) { push @o, "+$b[$j]"; $j++ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
$j < @b and $i >= @a || $L[$i][$j + 1] > $L[$i + 1][$j]
$i >= @a or $L[$i][$j + 1] > $L[$i + 1][$j]
MC/DC33%1/3
$j < @b and $i >= @a || $L[$i][$j + 1] > $L[$i + 1][$j]
$j < @b
$i >= @a
$L[$i][$j + 1] > $L[$i + 1][$j]
Truth table50%2/4
A and B or C
A= $j < @bB= $i >= @aC= $L[$i][$j + 1] > $L[$i + 1][$j]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 1 | else { push @o, "-$a[$i]"; $i++ } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 2 | ▶ | my @h = ( "diff --git a/$path b/$path", ( !defined $old ? 'new file mode 100644' : !defined $new ? 'deleted file mode 100644' : () ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | '--- ' . ( defined $old ? "a/$path" : '/dev/null' ), '+++ ' . ( defined $new ? "b/$path" : '/dev/null' ), sprintf( '@@ -%d,%d +%d,%d @@', @a ? 1 : 0, scalar @a, @b ? 1 : 0, scalar @b ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 2 | return join "\n", @h, @o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 9 | ▶ | sub _diff_trees { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_diff_trees: called CC=13 SCAR=26.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 9 | my ( $x, $y, $mode ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 9 | my @p = sort { $a cmp $b } keys %{ { %$x, %$y } }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 9 | ▶ | my @ch = grep { ( $x->{$_} // "\0none" ) ne ( $y->{$_} // "\0none" ) } @p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition75%3/4
$$x{$_} // "\0none"
$$y{$_} // "\0none"
MC/DC100%1/1
$$x{$_} // "\0none"
$$x{$_}
MC/DC0%0/1
$$y{$_} // "\0none"
$$y{$_}
Truth table100%2/2
A
A= $$x{$_}
Truth table50%1/2
A
A= $$y{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 9 | ▶ | return join( "\n", @ch ) if ( $mode // '' ) eq 'name-only'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$mode // ""
MC/DC100%1/1
$mode // ""
$mode
Truth table100%2/2
A
A= $mode
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 2 | ▶ | if ( ( $mode // '' ) eq 'stat' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$mode // ""
MC/DC100%1/1
$mode // ""
$mode
Truth table100%2/2
A
A= $mode
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 1 | ▶ | return '' unless @ch; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 1 | my ( $ins, $del ) = ( 0, 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 1 | my @l = map { my $d = _udiff( $_, $x->{$_}, $y->{$_} ); my $pl = () = $d =~ /^\+(?!\+\+ )/mg; my $mi = () = $d =~ /^-(?!-- )/mg; $ins += $pl; $del += $mi; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 1 | sprintf( ' %-30s | %3d %s', $_, $pl + $mi, ( '+' x $pl ) . ( '-' x $mi ) ) } @ch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 1 | ▶ | return join "\n", @l, sprintf( ' %d file%s changed', scalar @ch, @ch == 1 ? '' : 's' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | . ( $ins ? sprintf( ', %d insertion%s(+)', $ins, $ins == 1 ? '' : 's' ) : '' ) . ( $del ? sprintf( ', %d deletion%s(-)', $del, $del == 1 ? '' : 's' ) : '' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 1 | return join "\n", map { _udiff( $_, $x->{$_}, $y->{$_} ) } @ch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | # --- Kommandozeile ---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 75 | ▶ | sub git { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
git: called CC=33 SCAR=43.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 75 | my ( $dev, $av, $ctx, $cwd ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 75 | my @a = @$av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 75 | my $dir = $cwd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 75 | ▶ | while ( @a && $a[0] =~ /\A-/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@a and $a[0] =~ /\A-/
MC/DC50%1/2
@a and $a[0] =~ /\A-/
@a
$a[0] =~ /\A-/
Truth table66%2/3
A and B
A= @aB= $a[0] =~ /\A-/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 4 | my $x = shift @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 4 | ▶ | if ( $x eq '-C' ) { my $d = shift @a // ''; $dir = $d =~ m{\A/} ? $d : ( $dir // '/root' ) . "/$d" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
Condition25%1/4
shift @a // ""
$dir // "/root"
MC/DC0%0/1
shift @a // ""
shift @a
MC/DC0%0/1
$dir // "/root"
$dir
Truth table50%1/2
A
A= shift @a
Truth table0%0/2
A
A= $dir
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | elsif ( $x eq '-c' ) { shift @a } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | ▶ | elsif ( $x eq '--no-pager' || $x eq '-P' ) { } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$x eq "--no-pager" or $x eq "-P"
MC/DC0%0/2
$x eq "--no-pager" or $x eq "-P"
$x eq "--no-pager"
$x eq "-P"
Truth table0%0/3
A or B
A= $x eq "--no-pager"B= $x eq "-P"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | elsif ( $x eq '--version' ) { return ( 'git version 2.39.5', 1 ) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | else { return ( "unknown option: $x\nusage: git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]", 0 ) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 75 | ▶ | my $verb = shift(@a) // return ( "usage: git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n <command> [<args>]", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift @a // (return "usage: git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n <command> [<args>]", 0)
MC/DC0%0/1
shift @a // (return "usage: git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n <command> [<args>]", 0)
shift @a
Truth table50%1/2
A
A= shift @a
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 75 | ▶ | $verb = 'status' if $verb eq 'st'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | if ( $verb eq 'config' && grep { $_ eq '--global' } @a ) { return _config( $dev, undef, \@a ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$verb eq "config" and grep {$_ eq "--global";} @a
MC/DC0%0/2
$verb eq "config" and grep {$_ eq "--global";} @a
$verb eq "config"
grep {$_ eq "--global";} @a
Truth table66%2/3
A and B
A= $verb eq "config"B= grep {$_ eq "--global";} @a
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 75 | ▶ | return ( 'git version 2.39.5', 1 ) if $verb eq 'version'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 75 | ▶ | my ( $root, $r ) = _repo_at( $dev, $dir // '/root' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$dir // "/root"
MC/DC100%1/1
$dir // "/root"
$dir
Truth table100%2/2
A
A= $dir
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 75 | ▶ | if ( !$r && ( my ( $bp, $key ) = _bare_at( $dev, $dir // '/root' ) ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%5/5
not $r and () = _bare_at($dev, $dir // "/root")
$dir // "/root"
MC/DC100%2/2
not $r and () = _bare_at($dev, $dir // "/root")
not $r
() = _bare_at($dev, $dir // "/root")
MC/DC100%1/1
$dir // "/root"
$dir
Truth table100%3/3
not(A) and B
A= not $rB= () = _bare_at($dev, $dir // "/root")
Truth table100%2/2
A
A= $dir
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | # Bare-Repo auf dem Server: lesen, Tags und Zweige setzen; kein Arbeitsbaum | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 4 | ▶ | return ( 'fatal: this operation must be run in a work tree', 0 ) if $verb =~ /\A(?:status|add|rm|mv|restore|commit|checkout|switch|reset|pull|merge|rebase|cherry-pick|revert|stash|diff|clean)\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 3 | ( my $sub = "_g_$verb" ) =~ s/-/_/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | my $f = $verb =~ /\A(?:log|show|tag|branch|rev-parse|describe|config|update-ref|ls-tree|for-each-ref|show-ref|cat-file|ls-remote|count-objects|rev-list|merge-base|fsck)\z/ && __PACKAGE__->can($sub) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | or do { push @GAPS, "git $verb (bare)"; return ( '', 0 ) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$verb =~ /\A(?:log|show|tag|branch|rev-parse|describe|config|update-ref|ls-tree|for-each-ref|show-ref|cat-file|ls-remote|count-objects|rev-list|merge-base|fsck)\z/ && __PACKAGE__->can($sub)
MC/DC0%0/2
$verb =~ /\A(?:log|show|tag|branch|rev-parse|describe|config|update-ref|ls-tree|for-each-ref|show-ref|cat-file|ls-remote|count-objects|rev-list|merge-base|fsck)\z/ && __PACKAGE__->can($sub)
$verb =~ /\A(?:log|show|tag|branch|rev-parse|describe|config|update-ref|ls-tree|for-each-ref|show-ref|cat-file|ls-remote|count-objects|rev-list|merge-base|fsck)\z/
__PACKAGE__->can($sub)
Truth table33%1/3
A && B
A= $verb =~ /\A(?:log|show|tag|branch|rev-parse|describe|config|update-ref|ls-tree|for-each-ref|show-ref|cat-file|ls-remote|count-objects|rev-list|merge-base|fsck)\z/B= __PACKAGE__->can($sub)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 3 | my $copy = _clone($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 3 | my $s = $copy->{forgejo}{repos}{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 3 | local $s->{branch} = 'main'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 3 | local $CWD = $dir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 3 | my ( $out, $ok ) = $f->( $copy, $bp, $s, \@a, $ctx ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 3 | delete $s->{branch}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 3 | ▶ | if ($ok) { view($s); %$dev = %$copy } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 3 | ▶ | return ( $out // '', $ok ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$out // ""
MC/DC0%0/1
$out // ""
$out
Truth table50%1/2
A
A= $out
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 71 | ▶ | unless ($r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 1 | ▶ | return ( "fatal: not a git repository (or any of the parent directories): .git", 0 ) unless $verb =~ /\A(?:clone|init|help)\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | push @GAPS, "git $verb"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | return ( '', 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 70 | ( my $sub = "_g_$verb" ) =~ s/-/_/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 70 | ▶ | my $f = $verb =~ /\A[a-z-]+\z/ && __PACKAGE__->can($sub); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$verb =~ /\A[a-z-]+\z/ && __PACKAGE__->can($sub)
MC/DC0%0/2
$verb =~ /\A[a-z-]+\z/ && __PACKAGE__->can($sub)
$verb =~ /\A[a-z-]+\z/
__PACKAGE__->can($sub)
Truth table33%1/3
A && B
A= $verb =~ /\A[a-z-]+\z/B= __PACKAGE__->can($sub)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 70 | ▶ | unless ($f) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | return ( "git: '$verb' is not a git command. See 'git --help'.", 0 ) unless $verb =~ /\A(?:stash|cherry-pick|revert|bisect|blame|reflog|worktree|submodule|clean|gc|fsck|am|apply|format-patch|grep|describe|shortlog|notes|archive|bundle|clone|init|filter-branch|filter-repo|lfs|range-diff|show-ref|cat-file|symbolic-ref|update-ref|for-each-ref|merge-base|whatchanged|sparse-checkout|mergetool|difftool|gui|help|commit-tree|hash-object|ls-tree|rev-list)\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | push @GAPS, "git $verb"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | return ( '', 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | # gescheiterte Aenderungen hinterlassen nichts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 70 | my $copy = _clone($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 70 | my ( $croot, $cr ) = _repo_at( $copy, $root ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 70 | local $CWD = $dir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 70 | my ( $out, $ok, $keep ) = $f->( $copy, $croot, $cr, \@a, $ctx ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 70 | ▶ | if ( $ok || $keep ) { %$dev = %$copy } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$ok or $keep
MC/DC100%2/2
$ok or $keep
$ok
$keep
Truth table100%3/3
A or B
A= $okB= $keep
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 70 | ▶ | return ( $out // '', $ok ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$out // ""
MC/DC0%0/1
$out // ""
$out
Truth table50%1/2
A
A= $out
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 1 | ▶ | sub _config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_config: called CC=31 SCAR=59.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 1 | my ( $dev, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 1 | my $global = !$r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 1 | my @x = grep { !/\A--(?:global|local)\z/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 1 | ▶ | my $c = $global ? ( $dev->{git}{config} ||= {} ) : ( $r->{config} ||= {} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition25%1/4
$$dev{"git"}{"config"} ||= {}
$$r{"config"} ||= {}
MC/DC0%0/1
$$dev{"git"}{"config"} ||= {}
$$dev{"git"}{"config"}
MC/DC0%0/1
$$r{"config"} ||= {}
$$r{"config"}
Truth table0%0/2
A
A= $$dev{"git"}{"config"}
Truth table50%1/2
A
A= $$r{"config"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 1 | ▶ | if ( grep { $_ eq '--list' || $_ eq '-l' } @x ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_ eq '--list' || $_ eq '-l'
MC/DC0%0/2
$_ eq '--list' || $_ eq '-l'
$_ eq '--list'
$_ eq '-l'
Truth table33%1/3
A || B
A= $_ eq '--list'B= $_ eq '-l'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | ▶ | my %all = $global ? %$c : ( %{ ( $dev->{git} || {} )->{config} || {} }, 'core.repositoryformatversion' => 0, 'core.bare' => 'false', %$c, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
($$dev{'git'} || {})->{'config'} || {}
$$dev{'git'} || {}
MC/DC0%0/1
($$dev{'git'} || {})->{'config'} || {}
$$dev{'git'}
Truth table0%0/2
A
A= $$dev{'git'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | ▶ | map { ( "remote.$_.url" => $r->{remotes}{$_}{url}, "remote.$_.fetch" => "+refs/heads/*:refs/remotes/$_/*" ) } sort keys %{ $r->{remotes} || {} } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$$r{'remotes'} || {}
MC/DC0%0/1
$$r{'remotes'} || {}
$$r{'remotes'}
Truth table0%0/2
A
A= $$r{'remotes'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | return ( join( "\n", map {"$_=$all{$_}"} sort keys %all ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | if ( ( $x[0] // '' ) eq '--unset' ) { my $k = $x[1] // return ( 'error: wrong number of arguments', 0 ); return ( '', 0 ) unless exists $c->{$k}; delete $c->{$k}; return ( '', 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition25%1/4
$x[0] // ""
$x[1] // (return "error: wrong number of arguments", 0)
MC/DC0%0/1
$x[0] // ""
$x[0]
MC/DC0%0/1
$x[1] // (return "error: wrong number of arguments", 0)
$x[1]
Truth table50%1/2
A
A= $x[0]
Truth table0%0/2
A
A= $x[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 1 | ▶ | my $get = ( $x[0] // '' ) eq '--get' ? shift @x : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$x[0] // ""
MC/DC0%0/1
$x[0] // ""
$x[0]
Truth table50%1/2
A
A= $x[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 1 | my ( $k, $v ) = @x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 1 | ▶ | return ( 'error: key does not contain a section: ' . ( $k // '' ), 0 ) unless defined $k && $k =~ /\./; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
defined $k and $k =~ /\./
$k // ""
MC/DC0%0/2
defined $k and $k =~ /\./
defined $k
$k =~ /\./
MC/DC0%0/1
$k // ""
$k
Truth table33%1/3
A and B
A= defined $kB= $k =~ /\./
Truth table0%0/2
A
A= $k
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 1 | ▶ | if ( !defined $v ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | my $val = $global ? $c->{$k} : $c->{$k} // ( ( $dev->{git} || {} )->{config} || {} )->{$k}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/7
$$c{$k} // (($$dev{"git"} || {})->{"config"} || {})->{$k}
($$dev{'git'} || {})->{'config'} || {}
$$dev{'git'} || {}
MC/DC0%0/2
$$c{$k} // (($$dev{"git"} || {})->{"config"} || {})->{$k}
$$c{$k}
$$dev{'git'}
Truth table0%0/3
A // B
A= $$c{$k}B= $$dev{'git'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | $val //= $r->{remotes}{$1}{url} if !$global && $k =~ /\Aremote\.([^.]+)\.url\z/ && $r->{remotes}{$1}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
not $global and $k =~ /\Aremote\.([^.]+)\.url\z/ and $$r{"remotes"}{$1}
not $global and $k =~ /\Aremote\.([^.]+)\.url\z/
$val //= $$r{"remotes"}{$1}{"url"}
MC/DC0%0/3
not $global and $k =~ /\Aremote\.([^.]+)\.url\z/ and $$r{"remotes"}{$1}
not $global
$k =~ /\Aremote\.([^.]+)\.url\z/
$$r{"remotes"}{$1}
MC/DC0%0/2
$val //= $$r{"remotes"}{$1}{"url"}
$val
$$r{"remotes"}{$1}{"url"}
Truth table0%0/4
not(A) and B and C
A= not $globalB= $k =~ /\Aremote\.([^.]+)\.url\z/C= $$r{"remotes"}{$1}
Truth table0%0/3
A //= B
A= $valB= $$r{"remotes"}{$1}{"url"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | ▶ | return defined $val ? ( $val, 1 ) : ( '', 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 1 | ▶ | if ( !$global && $k =~ /\Aremote\.([^.]+)\.url\z/ ) { # steht in .git/config beim Remote | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $global and $k =~ /\Aremote\.([^.]+)\.url\z/
MC/DC0%0/2
not $global and $k =~ /\Aremote\.([^.]+)\.url\z/
not $global
$k =~ /\Aremote\.([^.]+)\.url\z/
Truth table33%1/3
not(A) and B
A= not $globalB= $k =~ /\Aremote\.([^.]+)\.url\z/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | $r->{remotes}{$1} = { url => $v, _resolve_remote( $dev, $v ) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | return ( '', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 1 | $c->{ lc($k) =~ s/\A(user|core|push|pull|init|commit)\.(.*)\z/$1.$2/r } = $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 1 | return ( '', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 1 | ▶ | sub _g_config { my ( $dev, $root, $r, $a ) = @_; return _config( $dev, $r, $a ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_config: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 2 | ▶ | sub _g_remote { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_remote: called CC=33 SCAR=50.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 2 | my ( $dev, $root, $r, $a, $ctx ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 2 | ▶ | my $rm = $r->{remotes} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{'remotes'} || {}
MC/DC0%0/1
$$r{'remotes'} || {}
$$r{'remotes'}
Truth table50%1/2
A
A= $$r{'remotes'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | ▶ | return ( join( "\n", map { ( "$_\t$rm->{$_}{url} (fetch)", "$_\t$rm->{$_}{url} (push)" ) } sort keys %$rm ), 1 ) if grep { $_ eq '-v' } @$a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 2 | ▶ | return ( join( "\n", sort keys %$rm ), 1 ) unless @$a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | if ( $a->[0] eq 'get-url' ) { my $x = $rm->{ $a->[1] // '' } or return ( "error: No such remote '" . ( $a->[1] // '' ) . "'", 0 ); return ( $x->{url}, 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/4
$$a[1] // ""
$$a[1] // ""
MC/DC0%0/1
$$a[1] // ""
$$a[1]
MC/DC0%0/1
$$a[1] // ""
$$a[1]
Truth table0%0/2
A
A= $$a[1]
Truth table0%0/2
A
A= $$a[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 2 | ▶ | if ( $a->[0] eq 'set-url' || $a->[0] eq 'add' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$$a[0] eq "set-url" or $$a[0] eq "add"
MC/DC50%1/2
$$a[0] eq "set-url" or $$a[0] eq "add"
$$a[0] eq "set-url"
$$a[0] eq "add"
Truth table66%2/3
A or B
A= $$a[0] eq "set-url"B= $$a[0] eq "add"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 1 | my ( undef, $name, $url ) = grep { !/\A--/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 1 | ▶ | return ( 'usage: git remote ' . $a->[0] . ' <name> <newurl>', 0 ) unless defined $url; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 1 | ▶ | return ( "error: No such remote '$name'", 0 ) if $a->[0] eq 'set-url' && !$rm->{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$$a[0] eq "set-url" and not $$rm{$name}
MC/DC0%0/2
$$a[0] eq "set-url" and not $$rm{$name}
$$a[0] eq "set-url"
not $$rm{$name}
Truth table33%1/3
A and not(B)
A= $$a[0] eq "set-url"B= not $$rm{$name}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 1 | ▶ | return ( "error: remote $name already exists.", 0 ) if $a->[0] eq 'add' && $rm->{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$$a[0] eq "add" and $$rm{$name}
MC/DC0%0/2
$$a[0] eq "add" and $$rm{$name}
$$a[0] eq "add"
$$rm{$name}
Truth table33%1/3
A and B
A= $$a[0] eq "add"B= $$rm{$name}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 1 | $r->{remotes}{$name} = { url => $url, _resolve_remote( $dev, $url ) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 1 | return ( '', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 1 | ▶ | if ( $a->[0] eq 'remove' || $a->[0] eq 'rm' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$$a[0] eq "remove" or $$a[0] eq "rm"
MC/DC0%0/2
$$a[0] eq "remove" or $$a[0] eq "rm"
$$a[0] eq "remove"
$$a[0] eq "rm"
Truth table33%1/3
A or B
A= $$a[0] eq "remove"B= $$a[0] eq "rm"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | ▶ | my $name = $a->[1] // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$a[1] // ""
MC/DC0%0/1
$$a[1] // ""
$$a[1]
Truth table0%0/2
A
A= $$a[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | return ( "error: No such remote: '$name'", 0 ) unless $rm->{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | delete $r->{remotes}{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | delete $r->{refs}{remotes}{$_} for grep { index( $_, "$name/" ) == 0 } keys %{ $r->{refs}{remotes} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$r{'refs'}{'remotes'} || {}
MC/DC0%0/1
$$r{'refs'}{'remotes'} || {}
$$r{'refs'}{'remotes'}
Truth table0%0/2
A
A= $$r{'refs'}{'remotes'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | return ( '', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 1 | ▶ | if ( $a->[0] eq 'show' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 1 | ▶ | my $name = $a->[1] // 'origin'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$a[1] // "origin"
MC/DC0%0/1
$$a[1] // "origin"
$$a[1]
Truth table50%1/2
A
A= $$a[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 1 | ▶ | my $x = $rm->{$name} or return ( "fatal: '$name' does not appear to be a git repository\nfatal: Could not read from remote repository.", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 1 | my ( $s, $err ) = _server( $ctx, $r, $name ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 1 | ▶ | return ( $err, 0 ) unless $s; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 1 | ▶ | my @b = sort keys %{ $s->{refs}{heads} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$s{'refs'}{'heads'} || {}
MC/DC0%0/1
$$s{'refs'}{'heads'} || {}
$$s{'refs'}{'heads'}
Truth table50%1/2
A
A= $$s{'refs'}{'heads'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 1 | ▶ | my $loc = $r->{refs}{heads} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{'refs'}{'heads'} || {}
MC/DC0%0/1
$$r{'refs'}{'heads'} || {}
$$r{'refs'}{'heads'}
Truth table50%1/2
A
A= $$r{'refs'}{'heads'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | return ( join( "\n", "* remote $name", " Fetch URL: $x->{url}", " Push URL: $x->{url}", ' HEAD branch: main', ' Remote branch' . ( @b > 1 ? 'es:' : ':' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 1 | ▶ | ( map { " $_ " . ( exists( ( $r->{refs}{remotes} || {} )->{"$name/$_"} ) ? 'tracked' : "new (next fetch will store in remotes/$name)" ) } @b ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$r{'refs'}{'remotes'} || {}
MC/DC0%0/1
$$r{'refs'}{'remotes'} || {}
$$r{'refs'}{'remotes'}
Truth table50%1/2
A
A= $$r{'refs'}{'remotes'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | " Local ref configured for 'git push':", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 1 | ( map { my $l = $loc->{$_}; my $sv = $s->{refs}{heads}{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 1 | ▶ | " $_ pushes to $_ (" . ( !defined $sv ? 'create' : $l eq $sv ? 'up to date' : _ancestors( $r, $l )->{$sv} ? 'fast-forwardable' : 'local out of date' ) . ')' } grep { exists $loc->{$_} } @b ) ), 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | push @GAPS, "git remote @$a"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | return ( '', 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 13 | ▶ | sub virtual { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
virtual: called CC=26 SCAR=35.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 13 | my ( $dev, $path ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 13 | ▶ | return undef unless defined $path && $path =~ m{\.git(?:/|\z)}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $path and $path =~ m[\.git(?:/|\z)]
MC/DC0%0/2
defined $path and $path =~ m[\.git(?:/|\z)]
defined $path
$path =~ m[\.git(?:/|\z)]
Truth table33%1/3
A and B
A= defined $pathB= $path =~ m[\.git(?:/|\z)]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 13 | my ( $gd, $rest, $r, $bare ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 13 | ▶ | for my $root ( keys %{ ( $dev->{git} || {} )->{repos} || {} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%4/4
($$dev{'git'} || {})->{'repos'} || {}
$$dev{'git'} || {}
MC/DC100%1/1
($$dev{'git'} || {})->{'repos'} || {}
$$dev{'git'}
Truth table100%2/2
A
A= $$dev{'git'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 5 | ▶ | next unless $path eq "$root/.git" || index( $path, "$root/.git/" ) == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$path eq "$root/.git" or index($path, "$root/.git/") == 0
MC/DC0%0/2
$path eq "$root/.git" or index($path, "$root/.git/") == 0
$path eq "$root/.git"
index($path, "$root/.git/") == 0
Truth table33%1/3
A or B
A= $path eq "$root/.git"B= index($path, "$root/.git/") == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 5 | ( $gd, $r ) = ( "$root/.git", $dev->{git}{repos}{$root} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 5 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 13 | ▶ | if ( !$r ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 8 | ▶ | my ( $bp, $key ) = _bare_at( $dev, $path ) or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 8 | ( $gd, $r, $bare ) = ( $bp, $dev->{forgejo}{repos}{$key}, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 13 | ( $rest = substr( $path, length $gd ) ) =~ s{\A/}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 13 | $rest =~ s{/\z}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 13 | ▶ | my $heads = $r->{refs}{heads} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{'refs'}{'heads'} || {}
MC/DC0%0/1
$$r{'refs'}{'heads'} || {}
$$r{'refs'}{'heads'}
Truth table50%1/2
A
A= $$r{'refs'}{'heads'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 13 | ▶ | my $tags = $r->{refs}{tags} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{'refs'}{'tags'} || {}
MC/DC0%0/1
$$r{'refs'}{'tags'} || {}
$$r{'refs'}{'tags'}
Truth table50%1/2
A
A= $$r{'refs'}{'tags'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 13 | ▶ | my $rem = $r->{refs}{remotes} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$$r{'refs'}{'remotes'} || {}
MC/DC100%1/1
$$r{'refs'}{'remotes'} || {}
$$r{'refs'}{'remotes'}
Truth table100%2/2
A
A= $$r{'refs'}{'remotes'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | my %files = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | HEAD => defined $r->{branch} || $bare ? 'ref: refs/heads/' . ( $r->{branch} // 'main' ) . "\n" : ( $r->{detached} // '' ) . "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | description => "Unnamed repository; edit this file 'description' to name the repository.\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | config => _git_config_text( $r, $bare ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 13 | ( map { ( "refs/heads/$_" => "$heads->{$_}\n" ) } keys %$heads ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 5 | ( map { ( "refs/tags/$_" => "$tags->{$_}{commit}\n" ) } keys %$tags ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 13 | ▶ | ( map { ( "refs/remotes/$_" => "$rem->{$_}\n" ) } keys %$rem ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition57%4/7
defined $$r{"branch"} or $bare
$$r{"branch"} // "main"
$$r{"detached"} // ""
MC/DC0%0/2
defined $$r{"branch"} or $bare
defined $$r{"branch"}
$bare
MC/DC100%1/1
$$r{"branch"} // "main"
$$r{"branch"}
MC/DC0%0/1
$$r{"detached"} // ""
$$r{"detached"}
Truth table66%2/3
A or B
A= defined $$r{"branch"}B= $bare
Truth table100%2/2
A
A= $$r{"branch"}
Truth table0%0/2
A
A= $$r{"detached"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 13 | ▶ | return { text => $files{$rest} } if exists $files{$rest}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 54 | ▶ | my %dirs = map { $_ => 1 } ( '', 'refs', 'refs/heads', 'refs/tags', 'objects', 'info', ( $bare ? () : ( 'hooks', 'logs' ) ), ( %$rem ? 'refs/remotes' : () ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 6 | map { my @p = split m{/}; map { join '/', @p[ 0 .. $_ ] } 0 .. $#p - 1 } keys %files ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 6 | ▶ | return undef unless $dirs{$rest}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 4 | my %n; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 4 | for my $p ( keys %files, keys %dirs ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 43 | ▶ | next if $p eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 39 | ▶ | $n{$1} = 1 if ( $rest eq '' ? $p : index( $p, "$rest/" ) == 0 ? substr( $p, length($rest) + 1 ) : "\0" ) =~ m{\A([^/\0]+)}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 4 | return { dir => [ sort keys %n ] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 13 | ▶ | sub _git_config_text { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_git_config_text: called CC=13 SCAR=27.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 13 | my ( $r, $bare ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 13 | ▶ | my $t = "[core]\n\trepositoryformatversion = 0\n\tfilemode = true\n\tbare = " . ( $bare ? 'true' : 'false' ) . "\n" . ( $bare ? '' : "\tlogallrefupdates = true\n" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 13 | ▶ | for my $n ( sort keys %{ $r->{remotes} || {} } ) { $t .= "[remote \"$n\"]\n\turl = $r->{remotes}{$n}{url}\n\tfetch = +refs/heads/*:refs/remotes/$n/*\n" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$$r{'remotes'} || {}
MC/DC100%1/1
$$r{'remotes'} || {}
$$r{'remotes'}
Truth table100%2/2
A
A= $$r{'remotes'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 13 | ▶ | for my $b ( sort keys %{ $r->{refs}{heads} || {} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{'refs'}{'heads'} || {}
MC/DC0%0/1
$$r{'refs'}{'heads'} || {}
$$r{'refs'}{'heads'}
Truth table50%1/2
A
A= $$r{'refs'}{'heads'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 13 | ▶ | $t .= "[branch \"$b\"]\n\tremote = origin\n\tmerge = refs/heads/$b\n" if exists( ( $r->{refs}{remotes} || {} )->{"origin/$b"} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$$r{'refs'}{'remotes'} || {}
MC/DC100%1/1
$$r{'refs'}{'remotes'} || {}
$$r{'refs'}{'remotes'}
Truth table100%2/2
A
A= $$r{'refs'}{'remotes'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 13 | my %sec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | for my $k ( sort keys %{ $r->{config} || {} } ) { my ( $s, $n ) = $k =~ /\A([^.]+)\.(.+)\z/ or next; push @{ $sec{$s} }, "\t$n = $r->{config}{$k}" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$r{'config'} || {}
MC/DC0%0/1
$$r{'config'} || {}
$$r{'config'}
Truth table50%1/2
A
A= $$r{'config'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | $t .= "[$_]\n" . join( "\n", @{ $sec{$_} } ) . "\n" for sort keys %sec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 13 | return $t; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 4 | ▶ | sub api { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
api: called CC=30 SCAR=49.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 4 | my ( $dev, $method, $path ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 4 | ▶ | my $fj = $dev->{forgejo} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$dev{'forgejo'} || {}
MC/DC0%0/1
$$dev{'forgejo'} || {}
$$dev{'forgejo'}
Truth table50%1/2
A
A= $$dev{'forgejo'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 4 | my $j = JSON::MaybeXS->new( canonical => 1, utf8 => 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 4 | $path =~ s/\?.*//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 4 | ▶ | return ( 405, '{"message":"method not allowed without token"}', 'json' ) if ( $method // 'GET' ) ne 'GET'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$method // "GET"
MC/DC0%0/1
$method // "GET"
$method
Truth table50%1/2
A
A= $method
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 4 | ▶ | return ( 200, "<!DOCTYPE html>\n<html lang=\"de-DE\">\n<head><title>Forgejo: Code von example.com</title></head>\n<body>Forgejo</body>\n</html>", 'html' ) if $path eq '/' || $path eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$path eq "/" or $path eq ""
MC/DC0%0/2
$path eq "/" or $path eq ""
$path eq "/"
$path eq ""
Truth table33%1/3
A or B
A= $path eq "/"B= $path eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 4 | ▶ | return ( 200, '{"version":"9.0.3+gitea-1.22.0"}', 'json' ) if $path eq '/api/v1/version'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 2 | ▶ | return ( 200, '{"message":"pong"}', 'json' ) if $path =~ m{\A/api/(?:v1/)?healthz?\z}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 2 | ▶ | if ( my ( $o, $n, $sub ) = $path =~ m{\A/api/v1/repos/([^/]+)/([^/]+?)(?:\.git)?(?:/(.*))?\z} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 2 | ▶ | my $s = ( $fj->{repos} || {} )->{"$o/$n"} or return ( 404, '{"errors":null,"message":"GetRepositoryByName","url":"' . ( $fj->{root_url} // '' ) . 'api/swagger"}', 'json' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition25%1/4
$$fj{'repos'} || {}
$$fj{"root_url"} // ""
MC/DC0%0/1
$$fj{'repos'} || {}
$$fj{'repos'}
MC/DC0%0/1
$$fj{"root_url"} // ""
$$fj{"root_url"}
Truth table50%1/2
A
A= $$fj{'repos'}
Truth table0%0/2
A
A= $$fj{"root_url"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 2 | ▶ | ( my $base = $fj->{root_url} // 'https://localhost/' ) =~ s{/*\z}{/}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$fj{"root_url"} // "https://localhost/"
MC/DC0%0/1
$$fj{"root_url"} // "https://localhost/"
$$fj{"root_url"}
Truth table50%1/2
A
A= $$fj{"root_url"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 2 | ( my $host = $base ) =~ s{\Ahttps?://([^/:]+).*}{$1}s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 2 | ▶ | $sub //= ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$sub //= ""
MC/DC0%0/1
$sub //= ""
$sub
Truth table50%1/2
A
A= $sub
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 2 | ▶ | if ( $sub eq '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | return ( 200, $j->encode( { id => 1, name => $n, full_name => "$o/$n", owner => { login => $o }, private => JSON::MaybeXS::false(), empty => JSON::MaybeXS::false(), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | archived => JSON::MaybeXS::false(), default_branch => 'main', html_url => "$base$o/$n", clone_url => "$base$o/$n.git", ssh_url => "git\@$host:$o/$n.git", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | has_actions => JSON::MaybeXS::true() } ), 'json' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 2 | ▶ | if ( $sub eq 'branches' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 1 | return ( 200, $j->encode( [ map { my $id = $s->{refs}{heads}{$_}; +{ name => $_, protected => exists( ( $s->{protected} || {} )->{$_} ) ? JSON::MaybeXS::true() : JSON::MaybeXS::false(), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 1 | ▶ | commit => { id => $id, message => ( $s->{commits}{$id} || {} )->{message} // '' } } } sort keys %{ $s->{refs}{heads} || {} } ] ), 'json' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%4/8
$$s{'protected'} || {}
($$s{"commits"}{$id} || {})->{"message"} // ""
$$s{'commits'}{$id} || {}
$$s{'refs'}{'heads'} || {}
MC/DC0%0/1
$$s{'protected'} || {}
$$s{'protected'}
MC/DC0%0/1
($$s{"commits"}{$id} || {})->{"message"} // ""
$$s{'commits'}{$id}
MC/DC0%0/1
$$s{'refs'}{'heads'} || {}
$$s{'refs'}{'heads'}
Truth table50%1/2
A
A= $$s{'protected'}
Truth table50%1/2
A
A= $$s{'commits'}{$id}
Truth table50%1/2
A
A= $$s{'refs'}{'heads'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 1 | ▶ | if ( $sub eq 'tags' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | ▶ | return ( 200, $j->encode( [ map { +{ name => $_, commit => { sha => $s->{refs}{tags}{$_}{commit} }, message => $s->{refs}{tags}{$_}{message} // '' } } sort keys %{ $s->{refs}{tags} || {} } ] ), 'json' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$$s{"refs"}{"tags"}{$_}{"message"} // ""
$$s{'refs'}{'tags'} || {}
MC/DC0%0/1
$$s{"refs"}{"tags"}{$_}{"message"} // ""
$$s{"refs"}{"tags"}{$_}{"message"}
MC/DC0%0/1
$$s{'refs'}{'tags'} || {}
$$s{'refs'}{'tags'}
Truth table0%0/2
A
A= $$s{"refs"}{"tags"}{$_}{"message"}
Truth table0%0/2
A
A= $$s{'refs'}{'tags'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 1 | ▶ | if ( $sub =~ m{\Acommits\z} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | ▶ | return ( 200, $j->encode( [ map { +{ sha => $_->{id}, commit => { message => $_->{message}, author => { name => $_->{author} } } } } @{ ( ( $s->{view} || {} )->{main} || {} )->{log} || [] } ] ), 'json' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
(($$s{'view'} || {})->{'main'} || {})->{'log'} || []
($$s{'view'} || {})->{'main'} || {}
$$s{'view'} || {}
MC/DC0%0/1
(($$s{'view'} || {})->{'main'} || {})->{'log'} || []
$$s{'view'}
Truth table0%0/2
A
A= $$s{'view'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 1 | ▶ | return ( 401, '{"message":"token is required","url":"' . $base . 'api/swagger"}', 'json' ) if $sub =~ m{\A(?:branch_protections|hooks|actions|keys|collaborators|teams)}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | return ( 404, '{"errors":null,"message":"not found","url":"' . $base . 'api/swagger"}', 'json' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | ▶ | return ( 401, '{"message":"token is required"}', 'json' ) if $path =~ m{\A/api/v1/(?:admin|user)\b}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | return ( 404, '{"errors":null,"message":"not found"}', 'json' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 2 | ▶ | sub _g_cat_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_cat_file: called CC=19 SCAR=36.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 2 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 2 | my ($mode) = grep {/\A-[pts]\z/} @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 2 | my ($obj) = grep { !/\A-/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 2 | ▶ | return ( 'usage: git cat-file (-t | -s | -e | -p | <type>) <object>', 0 ) unless defined $obj; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 2 | ▶ | my $type = $mode ? substr( $mode, 1 ) : 'p'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 2 | ▶ | if ( $obj =~ /\A(.*?):(.+)\z/ ) { # rev:pfad -> Datei | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 1 | ▶ | my $id = _rev( $r, length $1 ? $1 : 'HEAD' ) // return ( "fatal: Not a valid object name $obj", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
_rev($r, length $1 ? $1 : "HEAD") // (return "fatal: Not a valid object name $obj", 0)
MC/DC0%0/1
_rev($r, length $1 ? $1 : "HEAD") // (return "fatal: Not a valid object name $obj", 0)
_rev($r, length $1 ? $1 : "HEAD")
Truth table50%1/2
A
A= _rev($r, length $1 ? $1 : "HEAD")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 1 | my $t = _tree( $r, $id ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 1 | ▶ | return ( "fatal: path '$2' does not exist in '$1'", 0 ) unless exists $t->{$2}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 1 | ▶ | return ( 'blob', 1 ) if $type eq 't'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 1 | ▶ | return ( length( Encode::encode( 'UTF-8', $t->{$2} ) ), 1 ) if $type eq 's'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 1 | return ( $t->{$2} =~ s/\n\z//r, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 1 | ▶ | if ( my $tag = ( $r->{refs}{tags} || {} )->{$obj} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$r{'refs'}{'tags'} || {}
MC/DC0%0/1
$$r{'refs'}{'tags'} || {}
$$r{'refs'}{'tags'}
Truth table50%1/2
A
A= $$r{'refs'}{'tags'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | ▶ | if ( $tag->{annotated} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | ▶ | return ( 'tag', 1 ) if $type eq 't'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | ▶ | return ( join( "\n", "object $tag->{commit}", 'type commit', "tag $obj", 'tagger ' . ( $tag->{tagger} // '' ) . ' 1792832400 +0200', '', $tag->{message} // '' ), 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$$tag{"tagger"} // ""
$$tag{"message"} // ""
MC/DC0%0/1
$$tag{"tagger"} // ""
$$tag{"tagger"}
MC/DC0%0/1
$$tag{"message"} // ""
$$tag{"message"}
Truth table0%0/2
A
A= $$tag{"tagger"}
Truth table0%0/2
A
A= $$tag{"message"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 1 | ▶ | my $id = _rev( $r, $obj ) // return ( "fatal: Not a valid object name $obj", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
_rev($r, $obj) // (return "fatal: Not a valid object name $obj", 0)
MC/DC0%0/1
_rev($r, $obj) // (return "fatal: Not a valid object name $obj", 0)
_rev($r, $obj)
Truth table50%1/2
A
A= _rev($r, $obj)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 1 | my $c = $r->{commits}{$id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 1 | ▶ | return ( 'commit', 1 ) if $type eq 't'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 1 | ▶ | my $text = join "\n", 'tree ' . Digest::SHA::sha1_hex( 'tree:' . $id ), ( map {"parent $_"} @{ $c->{parents} || [] } ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$c{'parents'} || []
MC/DC0%0/1
$$c{'parents'} || []
$$c{'parents'}
Truth table50%1/2
A
A= $$c{'parents'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 1 | "author $c->{author} $c->{date} +0200", "committer $c->{author} $c->{date} +0200", '', $c->{message}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 1 | ▶ | return ( length( Encode::encode( 'UTF-8', "$text\n" ) ), 1 ) if $type eq 's'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 1 | return ( $text, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | sub _g_count_objects { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_count_objects: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | my ( $dev, $root, $r ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | ▶ | my $n = scalar keys %{ $r->{commits} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$r{'commits'} || {}
MC/DC0%0/1
$$r{'commits'} || {}
$$r{'commits'}
Truth table0%0/2
A
A= $$r{'commits'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | return ( ( $n * 3 ) . ' objects, ' . ( $n * 12 ) . ' kilobytes', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 2 | ▶ | sub _g_ls_tree { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_ls_tree: called CC=20 SCAR=33.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 2 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 2 | ▶ | my $rec = grep { $_ eq '-r' || $_ eq '-rt' || $_ eq '-tr' } @$a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
$_ eq '-r' || $_ eq '-rt' || $_ eq '-tr'
$_ eq "-r" or $_ eq "-rt"
MC/DC33%1/3
$_ eq '-r' || $_ eq '-rt' || $_ eq '-tr'
$_ eq "-r"
$_ eq "-rt"
$_ eq '-tr'
Truth table50%2/4
A or B || C
A= $_ eq "-r"B= $_ eq "-rt"C= $_ eq '-tr'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 2 | ▶ | my $name = grep { $_ eq '--name-only' || $_ eq '--name-status' } @$a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$_ eq '--name-only' || $_ eq '--name-status'
MC/DC50%1/2
$_ eq '--name-only' || $_ eq '--name-status'
$_ eq '--name-only'
$_ eq '--name-status'
Truth table66%2/3
A || B
A= $_ eq '--name-only'B= $_ eq '--name-status'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 2 | my ( $rev, @paths ) = grep { !/\A-/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 2 | ▶ | return ( 'usage: git ls-tree [<options>] <tree-ish> [<path>...]', 0 ) unless defined $rev; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 2 | ▶ | my $id = _rev( $r, $rev ) // return ( "fatal: Not a valid object name $rev", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
_rev($r, $rev) // (return "fatal: Not a valid object name $rev", 0)
MC/DC0%0/1
_rev($r, $rev) // (return "fatal: Not a valid object name $rev", 0)
_rev($r, $rev)
Truth table50%1/2
A
A= _rev($r, $rev)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 2 | my $t = _tree( $r, $id ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 2 | ▶ | my $blob = sub { Digest::SHA::sha1_hex( 'blob ' . length( Encode::encode( 'UTF-8', $_[0] ) ) . "\0" . Encode::encode( 'UTF-8', $_[0] ) ) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 2 | ▶ | my $pre = @paths ? $paths[0] =~ s{/*\z}{/}r : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 2 | ▶ | $pre = '' if $pre eq './'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 2 | my %e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 2 | for my $p ( sort keys %$t ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 9 | ▶ | next if length $pre && index( $p, $pre ) != 0 && $p ne ( $pre =~ s{/\z}{}r ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
length $pre and index($p, $pre) != 0 and $p ne $pre =~ s[/\z][]r
length $pre and index($p, $pre) != 0
MC/DC0%0/3
length $pre and index($p, $pre) != 0 and $p ne $pre =~ s[/\z][]r
length $pre
index($p, $pre) != 0
$p ne $pre =~ s[/\z][]r
Truth table25%1/4
A and B and C
A= length $preB= index($p, $pre) != 0C= $p ne $pre =~ s[/\z][]r
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 9 | ▶ | if ($rec) { $e{$p} = [ 'blob', $blob->( $t->{$p} ) ]; next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 5 | ▶ | my $rest = length $pre && index( $p, $pre ) == 0 ? substr( $p, length $pre ) : $p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
length $pre and index($p, $pre) == 0
MC/DC0%0/2
length $pre and index($p, $pre) == 0
length $pre
index($p, $pre) == 0
Truth table33%1/3
A and B
A= length $preB= index($p, $pre) == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 5 | my ($first) = split m{/}, $rest; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 5 | ▶ | my $full = ( length $pre && index( $p, $pre ) == 0 ? $pre : '' ) . $first; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
length $pre and index($p, $pre) == 0
MC/DC0%0/2
length $pre and index($p, $pre) == 0
length $pre
index($p, $pre) == 0
Truth table33%1/3
A and B
A= length $preB= index($p, $pre) == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 5 | ▶ | $e{$full} = $rest =~ m{/} ? [ 'tree', Digest::SHA::sha1_hex("tree:$id:$full") ] : [ 'blob', $blob->( $t->{$p} ) ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 2 | ▶ | return ( join( "\n", map { $name ? $_ : ( $e{$_}[0] eq 'tree' ? '040000' : '100644' ) . " $e{$_}[0] $e{$_}[1]\t$_" } sort keys %e ), 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | ▶ | sub _g_show_ref { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_show_ref: not called CC=10 SCAR=47.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | my $tagsonly = grep { $_ eq '--tags' } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | ▶ | my $headsonly = grep { $_ eq '--heads' || $_ eq '--branches' } @$a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$_ eq '--heads' || $_ eq '--branches'
MC/DC0%0/2
$_ eq '--heads' || $_ eq '--branches'
$_ eq '--heads'
$_ eq '--branches'
Truth table0%0/3
A || B
A= $_ eq '--heads'B= $_ eq '--branches'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | my @l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | ▶ | push @l, map {"$r->{refs}{heads}{$_} refs/heads/$_"} sort keys %{ $r->{refs}{heads} || {} } unless $tagsonly; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$$r{'refs'}{'heads'} || {}
MC/DC0%0/1
$$r{'refs'}{'heads'} || {}
$$r{'refs'}{'heads'}
Truth table0%0/2
A
A= $$r{'refs'}{'heads'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | ▶ | push @l, map {"$r->{refs}{remotes}{$_} refs/remotes/$_"} sort keys %{ $r->{refs}{remotes} || {} } unless $tagsonly || $headsonly; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$tagsonly or $headsonly
$$r{'refs'}{'remotes'} || {}
MC/DC0%0/2
$tagsonly or $headsonly
$tagsonly
$headsonly
MC/DC0%0/1
$$r{'refs'}{'remotes'} || {}
$$r{'refs'}{'remotes'}
Truth table0%0/3
A or B
A= $tagsonlyB= $headsonly
Truth table0%0/2
A
A= $$r{'refs'}{'remotes'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | ▶ | push @l, map {"$r->{refs}{tags}{$_}{commit} refs/tags/$_"} sort keys %{ $r->{refs}{tags} || {} } unless $headsonly; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$$r{'refs'}{'tags'} || {}
MC/DC0%0/1
$$r{'refs'}{'tags'} || {}
$$r{'refs'}{'tags'}
Truth table0%0/2
A
A= $$r{'refs'}{'tags'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | ▶ | return ( join( "\n", @l ), @l ? 1 : 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | ▶ | sub _g_for_each_ref { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_for_each_ref: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | my ($pat) = grep { !/\A-/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | my @l = map { my ( $id, $ref ) = split / /; "$id commit\t$ref" } split /\n/, ( _g_show_ref( $dev, $root, $r, [] ) )[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | ▶ | @l = grep { ( split /\t/ )[1] =~ m{\A\Q$pat\E} } @l if defined $pat; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | return ( join( "\n", @l ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | # Pfad in einem Bare-Repo des Servers (forgejo-repositories/<owner>/<name>.git) -> ( pfad, schluessel ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 13 | ▶ | sub _bare_at { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_bare_at: called CC=6 SCAR=18.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 13 | my ( $dev, $path ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 13 | ▶ | my $rs = ( $dev->{forgejo} || {} )->{repos} or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$$dev{'forgejo'} || {}
MC/DC100%1/1
$$dev{'forgejo'} || {}
$$dev{'forgejo'}
Truth table100%2/2
A
A= $$dev{'forgejo'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 12 | ▶ | my ( $base, $o, $n ) = ( $path // '' ) =~ m{\A(.*/forgejo-repositories)/([^/]+)/([^/]+?)\.git(?:/.*)?\z} or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$path // ""
MC/DC0%0/1
$path // ""
$path
Truth table50%1/2
A
A= $path
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 12 | ▶ | return $rs->{"$o/$n"} ? ( "$base/$o/$n.git", "$o/$n" ) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | ▶ | sub _g_update_ref { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_update_ref: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | my @p = grep { !/\A-/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | ▶ | if ( grep { $_ eq '-d' } @$a ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | my ($ref) = @p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | ▶ | ( my $n = $ref // '' ) =~ s{\Arefs/(heads|tags)/}{}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ref // ""
MC/DC0%0/1
$ref // ""
$ref
Truth table0%0/2
A
A= $ref
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | my $kind = $1 // 'heads'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$1 // "heads"
MC/DC0%0/1
$1 // "heads"
$1
Truth table0%0/2
A
A= $1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | ▶ | return ( "error: cannot lock ref '$ref': unable to resolve reference '$ref'", 0 ) unless exists $r->{refs}{$kind}{$n}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | delete $r->{refs}{$kind}{$n}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | return ( '', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | my ( $ref, $new ) = @p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | ▶ | return ( 'usage: git update-ref [<options>] <refname> <new-val> [<old-val>]', 0 ) unless defined $new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | ▶ | my $id = _rev( $r, $new ) // return ( "fatal: $new: not a valid SHA1", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
_rev($r, $new) // (return "fatal: ${new}: not a valid SHA1", 0)
MC/DC0%0/1
_rev($r, $new) // (return "fatal: ${new}: not a valid SHA1", 0)
_rev($r, $new)
Truth table0%0/2
A
A= _rev($r, $new)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | ▶ | ( my $n = $ref ) =~ s{\Arefs/(heads|tags)/}{} or return ( "fatal: update_ref failed for ref '$ref': refusing to update ref with bad name '$ref'", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | ▶ | if ( $1 eq 'tags' ) { $r->{refs}{tags}{$n} = { commit => $id } } else { $r->{refs}{heads}{$n} = $id } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | return ( '', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | # URL eines Remotes -> Server (host) und Repo (Pfad) ueber die bekannten Namen des Geraets | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 1 | ▶ | sub _resolve_remote { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_resolve_remote: called CC=6 SCAR=21.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 1 | my ( $dev, $url ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 1 | my ( $h, $path ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | ▶ | if ( $url =~ m{\Ahttps?://([^/:]+)(?::\d+)?/(.+?)(?:\.git)?/?\z} ) { ( $h, $path ) = ( $1, $2 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 1 | elsif ( $url =~ m{\A(?:ssh://)?(?:[^@/]+@)?([^:/]+)(?::\d+)?[:/](.+?)(?:\.git)?/?\z} ) { ( $h, $path ) = ( $1, $2 ) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | else { return () } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 1 | ▶ | my $hosts = ( $dev->{git} || {} )->{hosts} || {}; # Name -> Geraet (z. B. git.example.com -> git1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
($$dev{'git'} || {})->{'hosts'} || {}
$$dev{'git'} || {}
MC/DC0%0/1
($$dev{'git'} || {})->{'hosts'} || {}
$$dev{'git'}
Truth table50%1/2
A
A= $$dev{'git'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 1 | ▶ | return ( host => $hosts->{$h} // $h, repo => $path ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$$hosts{$h} // $h
MC/DC0%0/2
$$hosts{$h} // $h
$$hosts{$h}
$h
Truth table33%1/3
A // B
A= $$hosts{$h}B= $h
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | ▶ | sub _g_rev_parse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_rev_parse: not called CC=14 SCAR=53.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | my @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | my $abbrev = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | for my $x (@$a) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | ▶ | if ( $x eq '--abbrev-ref' ) { $abbrev = 1; next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | elsif ( $x eq '--show-toplevel' ) { push @out, $root; next } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | elsif ( $x eq '--short' ) { $abbrev = 2; next } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | elsif ( $x eq '--git-dir' ) { push @out, "$root/.git"; next } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | ▶ | if ( $abbrev == 1 && $x eq 'HEAD' ) { push @out, $r->{branch} // 'HEAD'; next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$abbrev == 1 and $x eq "HEAD"
$$r{"branch"} // "HEAD"
MC/DC0%0/2
$abbrev == 1 and $x eq "HEAD"
$abbrev == 1
$x eq "HEAD"
MC/DC0%0/1
$$r{"branch"} // "HEAD"
$$r{"branch"}
Truth table0%0/3
A and B
A= $abbrev == 1B= $x eq "HEAD"
Truth table0%0/2
A
A= $$r{"branch"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | ▶ | if ( $abbrev == 1 && $x =~ /\@\{u/ ) { push @out, "origin/" . ( $r->{branch} // '' ); next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$abbrev == 1 and $x =~ /\@\{u/
$$r{"branch"} // ""
MC/DC0%0/2
$abbrev == 1 and $x =~ /\@\{u/
$abbrev == 1
$x =~ /\@\{u/
MC/DC0%0/1
$$r{"branch"} // ""
$$r{"branch"}
Truth table0%0/3
A and B
A= $abbrev == 1B= $x =~ /\@\{u/
Truth table0%0/2
A
A= $$r{"branch"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | ▶ | my $id = _rev( $r, $x ) // return ( "fatal: ambiguous argument '$x': unknown revision or path not in the working tree.", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
_rev($r, $x) // (return "fatal: ambiguous argument '${x}': unknown revision or path not in the working tree.", 0)
MC/DC0%0/1
_rev($r, $x) // (return "fatal: ambiguous argument '${x}': unknown revision or path not in the working tree.", 0)
_rev($r, $x)
Truth table0%0/2
A
A= _rev($r, $x)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | ▶ | push @out, $abbrev == 2 ? _short($id) : $id; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | return ( join( "\n", @out ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 5 | ▶ | sub _tracking { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tracking: called CC=4 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 5 | my ($r) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 5 | ▶ | my $b = $r->{branch} // return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{"branch"} // (return ())
MC/DC0%0/1
$$r{"branch"} // (return ())
$$r{"branch"}
Truth table50%1/2
A
A= $$r{"branch"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 5 | ▶ | my $up = ( $r->{refs}{remotes} || {} )->{"origin/$b"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{'refs'}{'remotes'} || {}
MC/DC0%0/1
$$r{'refs'}{'remotes'} || {}
$$r{'refs'}{'remotes'}
Truth table50%1/2
A
A= $$r{'refs'}{'remotes'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 5 | ▶ | return () unless defined $up; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 5 | my $h = _head($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 5 | my $ahead = () = _range( $r, $up, $h ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 5 | my $behind = () = _range( $r, $h, $up ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 5 | return ( "origin/$b", $ahead, $behind ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 30 | ▶ | sub _changes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_changes: called CC=14 SCAR=28.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 30 | my ( $dev, $root, $r ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 30 | my $head = _tree( $r, _head($r) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 30 | my $idx = _index($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 30 | my $w = _work( $dev, $root ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 30 | my @ig = _ignore_res($w); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 30 | my ( @staged, @unstaged, @untracked ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 30 | for my $p ( sort keys %{ { %$head, %$idx } } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 127 | ▶ | next if ( $head->{$p} // "\0" ) eq ( $idx->{$p} // "\0" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%2/4
$$head{$p} // "\0"
$$idx{$p} // "\0"
MC/DC0%0/1
$$head{$p} // "\0"
$$head{$p}
MC/DC0%0/1
$$idx{$p} // "\0"
$$idx{$p}
Truth table50%1/2
A
A= $$head{$p}
Truth table50%1/2
A
A= $$idx{$p}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | ▶ | push @staged, [ !exists $head->{$p} ? 'new file' : !exists $idx->{$p} ? 'deleted' : 'modified', $p ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 30 | for my $p ( sort keys %$idx ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 127 | ▶ | next if ( $w->{$p} // "\0" ) eq $idx->{$p}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$w{$p} // "\0"
MC/DC0%0/1
$$w{$p} // "\0"
$$w{$p}
Truth table50%1/2
A
A= $$w{$p}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 7 | ▶ | push @unstaged, [ exists $w->{$p} ? 'modified' : 'deleted', $p ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 30 | ▶ | for my $p ( sort keys %$w ) { push @untracked, $p unless exists $idx->{$p} || _ignored( \@ig, $p ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
exists $$idx{$p} or _ignored(\@ig, $p)
MC/DC100%2/2
exists $$idx{$p} or _ignored(\@ig, $p)
exists $$idx{$p}
_ignored(\@ig, $p)
Truth table100%3/3
A or B
A= exists $$idx{$p}B= _ignored(\@ig, $p)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 30 | return ( \@staged, \@unstaged, \@untracked ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 5 | ▶ | sub _g_status { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_status: called CC=32 SCAR=43.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 5 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 5 | my ( $st, $un, $ut ) = _changes( $dev, $root, $r ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 5 | ▶ | if ( grep { /\A(?:-s|--short|--porcelain(?:=v1)?|-sb)\z/ } @$a ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 2 | my %m; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 2 | $m{ $_->[1] }[0] = substr( uc $_->[0], 0, 1 ) =~ s/N/A/r for @$st; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 2 | $m{ $_->[1] }[1] = substr( uc $_->[0], 0, 1 ) for @$un; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 2 | my @tr = _tracking($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 2 | ▶ | my $ab = @tr && ( $tr[1] || $tr[2] ) ? ' [' . join( ', ', ( $tr[1] ? "ahead $tr[1]" : () ), ( $tr[2] ? "behind $tr[2]" : () ) ) . ']' : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition33%2/6
@tr and $tr[1] || $tr[2]
$tr[1] or $tr[2]
MC/DC0%0/3
@tr and $tr[1] || $tr[2]
@tr
$tr[1]
$tr[2]
Truth table25%1/4
A and B or C
A= @trB= $tr[1]C= $tr[2]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 2 | ▶ | my @l = ( ( grep { /\A-\w*b/ || $_ eq '--branch' } @$a ) ? '## ' . ( $r->{branch} // 'HEAD (no branch)' ) . ( @tr ? "...$tr[0]$ab" : '' ) : () ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition20%1/5
/\A-\w*b/ || $_ eq '--branch'
$$r{"branch"} // "HEAD (no branch)"
MC/DC0%0/2
/\A-\w*b/ || $_ eq '--branch'
/\A-\w*b/
$_ eq '--branch'
MC/DC0%0/1
$$r{"branch"} // "HEAD (no branch)"
$$r{"branch"}
Truth table33%1/3
A || B
A= /\A-\w*b/B= $_ eq '--branch'
Truth table0%0/2
A
A= $$r{"branch"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 2 | ▶ | push @l, map { ( $m{$_}[0] // ' ' ) . ( $m{$_}[1] // ' ' ) . " $_" } sort keys %m; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$m{$_}[0] // " "
$m{$_}[1] // " "
MC/DC0%0/1
$m{$_}[0] // " "
$m{$_}[0]
MC/DC0%0/1
$m{$_}[1] // " "
$m{$_}[1]
Truth table50%1/2
A
A= $m{$_}[0]
Truth table50%1/2
A
A= $m{$_}[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 2 | push @l, map {"?? $_"} @$ut; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 2 | return ( join( "\n", @l ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 3 | ▶ | my @l = defined $r->{branch} ? ("On branch $r->{branch}") : ( 'HEAD detached at ' . _short( $r->{detached} ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 3 | ▶ | if ( my ( $up, $ah, $be ) = _tracking($r) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 3 | ▶ | push @l, $ah && $be ? ( "Your branch and '$up' have diverged,", "and have $ah and $be different commits each, respectively.", ' (use "git pull" to merge the remote branch into yours)' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
Condition66%2/3
$ah and $be
MC/DC0%0/2
$ah and $be
$ah
$be
Truth table66%2/3
A and B
A= $ahB= $be
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | : $ah ? ( "Your branch is ahead of '$up' by $ah commit" . ( $ah > 1 ? 's' : '' ) . '.', ' (use "git push" to publish your local commits)' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | : $be ? ( "Your branch is behind '$up' by $be commit" . ( $be > 1 ? 's' : '' ) . ', and can be fast-forwarded.', ' (use "git pull" to update your local branch)' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | : ("Your branch is up to date with '$up'."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | ▶ | push @l, '', 'Changes to be committed:', ' (use "git restore --staged <file>..." to unstage)', map( { sprintf "\t%-12s%s", "$_->[0]:", $_->[1] } @$st ) if @$st; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | push @l, '', 'Changes not staged for commit:', ' (use "git add <file>..." to update what will be committed)', ' (use "git restore <file>..." to discard changes in working directory)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 3 | ▶ | map( { sprintf "\t%-12s%s", "$_->[0]:", $_->[1] } @$un ) if @$un; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 3 | ▶ | push @l, '', 'Untracked files:', ' (use "git add <file>..." to include in what will be committed)', map( {"\t$_"} @$ut ) if @$ut; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 3 | ▶ | push @l, '', !@$st && !@$un ? ( @$ut ? 'nothing added to commit but untracked files present (use "git add" to track)' : 'nothing to commit, working tree clean' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition50%3/6
@$st and @$un
@$st || @$un
MC/DC0%0/2
@$st and @$un
@$st
@$un
MC/DC50%1/2
@$st || @$un
@$st
@$un
Truth table33%1/3
A and B
A= @$stB= @$un
Truth table66%2/3
A || B
A= @$stB= @$un
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | : !@$st ? 'no changes added to commit (use "git add" and/or "git commit -a")' : () if !@$st || !@$un; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 3 | return ( join( "\n", @l ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | # Pfadangaben (relativ zum Arbeitsverzeichnis) -> relative Pfade im Repo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 6 | ▶ | sub _paths { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_paths: called CC=8 SCAR=25.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 6 | my ( $root, $cwd, @p ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 6 | my @r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 6 | for my $x (@p) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 6 | ▶ | my $abs = $x =~ m{\A/} ? $x : ( $cwd // $root ) . "/$x"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$cwd // $root
MC/DC0%0/2
$cwd // $root
$cwd
$root
Truth table0%0/3
A // B
A= $cwdB= $root
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 6 | ▶ | 1 while $abs =~ s{/\./}{/} || $abs =~ s{/[^/]+/\.\.(?:/|\z)}{/}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$abs =~ s[/\./][/] or $abs =~ s[/[^/]+/\.\.(?:/|\z)][/]
MC/DC0%0/2
$abs =~ s[/\./][/] or $abs =~ s[/[^/]+/\.\.(?:/|\z)][/]
$abs =~ s[/\./][/]
$abs =~ s[/[^/]+/\.\.(?:/|\z)][/]
Truth table33%1/3
A or B
A= $abs =~ s[/\./][/]B= $abs =~ s[/[^/]+/\.\.(?:/|\z)][/]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 6 | $abs =~ s{/\.?\z}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 6 | ▶ | push @r, $abs eq $root ? '' : index( $abs, "$root/" ) == 0 ? substr( $abs, length($root) + 1 ) : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 6 | return @r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 5 | ▶ | sub _match_paths { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_match_paths: called CC=4 SCAR=14.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 5 | my ( $tree, $pat ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 5 | ▶ | return grep { $pat eq '' || $_ eq $pat || index( $_, "$pat/" ) == 0 || _glob_match( $pat, $_ ) } sort keys %$tree; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%6/9
$pat eq '' || $_ eq $pat || index($_, "$pat/") == 0 || _glob_match($pat, $_)
$pat eq "" or $_ eq $pat or index($_, "$pat/") == 0
$pat eq "" or $_ eq $pat
MC/DC25%1/4
$pat eq '' || $_ eq $pat || index($_, "$pat/") == 0 || _glob_match($pat, $_)
$pat eq ""
$_ eq $pat
index($_, "$pat/") == 0
_glob_match($pat, $_)
Truth table40%2/5
A or B or C || D
A= $pat eq ""B= $_ eq $patC= index($_, "$pat/") == 0D= _glob_match($pat, $_)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 0 | ▶ | sub _glob_match { my ( $g, $p ) = @_; return 0 unless $g =~ /[*?]/; ( my $re = quotemeta $g ) =~ s/\\\*/.*/g; $re =~ s/\\\?/./g; return $p =~ /\A$re\z/ ? 1 : 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_glob_match: called CC=3 SCAR=17.3
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 3 | ▶ | sub _g_add { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_add: called CC=18 SCAR=38.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 3 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 3 | my @o = grep {/\A-/} @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 3 | my @p = grep { !/\A-/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | ▶ | return ( "Nothing specified, nothing added.\nhint: Maybe you wanted to say 'git add .'?", 0 ) unless @p || grep { /\A(?:-A|--all|-u|--update)\z/ } @o; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@p or grep {/\A(?:-A|--all|-u|--update)\z/;} @o
MC/DC0%0/2
@p or grep {/\A(?:-A|--all|-u|--update)\z/;} @o
@p
grep {/\A(?:-A|--all|-u|--update)\z/;} @o
Truth table33%1/3
A or B
A= @pB= grep {/\A(?:-A|--all|-u|--update)\z/;} @o
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | ▶ | return do { push @GAPS, 'git add -p'; ( '', 0 ) } if grep { /\A(?:-p|--patch|-i|--interactive)\z/ } @o; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 3 | my $w = _work( $dev, $root ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 3 | my $idx = _index($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 3 | my @ig = _ignore_res($w); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 0 | my $all = grep { /\A(?:-A|--all)\z/ } @o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 0 | my $upd = grep { /\A(?:-u|--update)\z/ } @o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 0 | my $force = grep { /\A(?:-f|--force)\z/ } @o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 3 | ▶ | @p = ('') if !@p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 3 | for my $pat ( _paths( $root, $CWD, @p ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 3 | ▶ | return ( "fatal: pathspec outside repository", 0 ) unless defined $pat; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 3 | my @hit = _match_paths( { %$w, %$idx }, $pat ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 3 | ▶ | return ( "fatal: pathspec '$pat' did not match any files", 0 ) unless @hit || $pat eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@hit or $pat eq ""
MC/DC0%0/2
@hit or $pat eq ""
@hit
$pat eq ""
Truth table33%1/3
A or B
A= @hitB= $pat eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 3 | for my $f (@hit) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 3 | ▶ | next if $upd && !exists $idx->{$f}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$upd and not exists $$idx{$f}
MC/DC0%0/2
$upd and not exists $$idx{$f}
$upd
not exists $$idx{$f}
Truth table33%1/3
A and not(B)
A= $updB= not exists $$idx{$f}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 3 | ▶ | if ( exists $w->{$f} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 3 | ▶ | if ( !exists $idx->{$f} && _ignored( \@ig, $f ) && !$force ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
not exists $$idx{$f} and _ignored(\@ig, $f) and not $force
not exists $$idx{$f} and _ignored(\@ig, $f)
MC/DC0%0/3
not exists $$idx{$f} and _ignored(\@ig, $f) and not $force
not exists $$idx{$f}
_ignored(\@ig, $f)
not $force
Truth table50%2/4
not(A) and B and not(C)
A= not exists $$idx{$f}B= _ignored(\@ig, $f)C= not $force
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | ▶ | return ( "The following paths are ignored by one of your .gitignore files:\n$f\nhint: Use -f if you really want to add them.", 0 ) if $pat eq $f; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 3 | $idx->{$f} = $w->{$f}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | elsif ( exists $idx->{$f} ) { delete $idx->{$f} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 3 | $r->{index} = $idx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 3 | return ( '', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 1 | ▶ | sub _g_rm { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_rm: called CC=11 SCAR=26.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 1 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 1 | my $cached = grep { $_ eq '--cached' } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 1 | my $rec = grep { /\A-r|\A-rf\z|\A-fr\z/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 1 | my $idx = _index($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 1 | my @p = grep { !/\A-/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 1 | my @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 1 | for my $pat ( _paths( $root, $CWD, @p ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 1 | ▶ | my @hit = grep { exists $idx->{$_} } _match_paths( $idx, $pat // "\0" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$pat // "\0"
MC/DC0%0/1
$pat // "\0"
$pat
Truth table50%1/2
A
A= $pat
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 1 | ▶ | return ( "fatal: pathspec '" . ( $pat // '' ) . "' did not match any files", 0 ) unless @hit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$pat // ""
MC/DC0%0/1
$pat // ""
$pat
Truth table0%0/2
A
A= $pat
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 1 | ▶ | return ( "fatal: not removing '$pat' recursively without -r", 0 ) if !$rec && ( @hit > 1 || $hit[0] ne $pat ) && !_glob_match( $pat, $hit[0] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
not $rec and @hit > 1 || $hit[0] ne $pat and not _glob_match($pat, $hit[0])
not $rec and @hit > 1 || $hit[0] ne $pat
@hit > 1 or $hit[0] ne $pat
MC/DC0%0/4
not $rec and @hit > 1 || $hit[0] ne $pat and not _glob_match($pat, $hit[0])
not $rec
@hit > 1
$hit[0] ne $pat
not _glob_match($pat, $hit[0])
Truth table16%1/6
not(A) and B or C and not(D)
A= not $recB= @hit > 1C= $hit[0] ne $patD= not _glob_match($pat, $hit[0])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 1 | for my $f (@hit) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 1 | delete $idx->{$f}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 1 | ▶ | delete $dev->{files}{"$root/$f"} unless $cached; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 1 | push @out, "rm '$f'"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 1 | $r->{index} = $idx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 1 | return ( join( "\n", @out ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | ▶ | sub _g_mv { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_mv: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 0 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | my @p = grep { !/\A-/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | ▶ | return ( 'usage: git mv [<options>] <source>... <destination>', 0 ) unless @p == 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | my ( $from, $to ) = _paths( $root, $CWD, @p ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 0 | my $idx = _index($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | ▶ | my @hit = grep { exists $idx->{$_} } _match_paths( $idx, $from // "\0" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$from // "\0"
MC/DC0%0/1
$from // "\0"
$from
Truth table0%0/2
A
A= $from
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | ▶ | return ( "fatal: not under version control, source=$p[0], destination=$p[1]", 0 ) unless @hit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | for my $f (@hit) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | ( my $n = $f ) =~ s/\A\Q$from\E/$to/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | ▶ | $n = "$to/" . ( $f =~ s{.*/}{}r ) if @hit == 1 && $f eq $from && exists( { map { ( $_ =~ s{/[^/]+\z}{}r ) => 1 } keys %$idx }->{$to} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
@hit == 1 and $f eq $from and exists {map({$_ =~ s[/[^/]+\z][]r, 1;} keys %$idx)}->{$to}
@hit == 1 and $f eq $from
MC/DC0%0/3
@hit == 1 and $f eq $from and exists {map({$_ =~ s[/[^/]+\z][]r, 1;} keys %$idx)}->{$to}
@hit == 1
$f eq $from
exists {map({$_ =~ s[/[^/]+\z][]r, 1;} keys %$idx)}->{$to}
Truth table0%0/4
A and B and C
A= @hit == 1B= $f eq $fromC= exists {map({$_ =~ s[/[^/]+\z][]r, 1;} keys %$idx)}->{$to}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 0 | $idx->{$n} = delete $idx->{$f}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | my $e = delete $dev->{files}{"$root/$f"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | ▶ | $dev->{files}{"$root/$n"} = $e // $idx->{$n}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$e // $$idx{$n}
MC/DC0%0/2
$e // $$idx{$n}
$e
$$idx{$n}
Truth table0%0/3
A // B
A= $eB= $$idx{$n}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | $r->{index} = $idx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 0 | return ( '', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 1 | ▶ | sub _g_restore { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_restore: called CC=10 SCAR=28.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 1 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 1 | ▶ | my $staged = grep { $_ eq '--staged' || $_ eq '-S' } @$a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$_ eq '--staged' || $_ eq '-S'
MC/DC0%0/2
$_ eq '--staged' || $_ eq '-S'
$_ eq '--staged'
$_ eq '-S'
Truth table33%1/3
A || B
A= $_ eq '--staged'B= $_ eq '-S'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 1 | my $idx = _index($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 1 | my $head = _tree( $r, _head($r) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 1 | for my $pat ( _paths( $root, $CWD, grep { !/\A-/ } @$a ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 1 | ▶ | my @hit = _match_paths( { %$idx, %$head }, $pat // "\0" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$pat // "\0"
MC/DC0%0/1
$pat // "\0"
$pat
Truth table50%1/2
A
A= $pat
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 1 | ▶ | return ( "error: pathspec '" . ( $pat // '' ) . "' did not match any file(s) known to git", 0 ) unless @hit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$pat // ""
MC/DC0%0/1
$pat // ""
$pat
Truth table0%0/2
A
A= $pat
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 1 | for my $f (@hit) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 0 | ▶ | if ($staged) { if ( exists $head->{$f} ) { $idx->{$f} = $head->{$f} } else { delete $idx->{$f} } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 1 | elsif ( exists $idx->{$f} ) { $dev->{files}{"$root/$f"} = $idx->{$f} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 1 | $r->{index} = $idx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 1 | return ( '', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 7 | ▶ | sub _g_commit { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_commit: called CC=61 SCAR=62.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 7 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 7 | my ( @msg, $amend, $noedit, $all, $reset, $author, $empty ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 7 | my @x = @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 7 | ▶ | while (@x) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 9 | my $o = shift @x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 9 | ▶ | if ( $o eq '-m' || $o eq '--message' ) { push @msg, shift(@x) // '' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 12 branches
Condition60%3/5
$o eq "-m" or $o eq "--message"
shift @x // ""
MC/DC50%1/2
$o eq "-m" or $o eq "--message"
$o eq "-m"
$o eq "--message"
MC/DC0%0/1
shift @x // ""
shift @x
Truth table66%2/3
A or B
A= $o eq "-m"B= $o eq "--message"
Truth table50%1/2
A
A= shift @x
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 0 | elsif ( $o =~ /\A(?:-m|--message=)(.+)\z/s ) { push @msg, $1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 3 | ▶ | elsif ( $o =~ /\A-([a]*)m\z/ ) { $all = 1 if $1; push @msg, shift(@x) // '' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
shift @x // ""
MC/DC0%0/1
shift @x // ""
shift @x
Truth table50%1/2
A
A= shift @x
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | ▶ | elsif ( $o eq '-a' || $o eq '--all' ) { $all = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$o eq "-a" or $o eq "--all"
MC/DC0%0/2
$o eq "-a" or $o eq "--all"
$o eq "-a"
$o eq "--all"
Truth table33%1/3
A or B
A= $o eq "-a"B= $o eq "--all"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 2 | elsif ( $o eq '--amend' ) { $amend = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 1 | elsif ( $o eq '--no-edit' ) { $noedit = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | elsif ( $o eq '--reset-author' ) { $reset = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 0 | elsif ( $o =~ /\A--author=(.+)\z/ ) { $author = $1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | elsif ( $o eq '--author' ) { $author = shift @x } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 0 | elsif ( $o eq '--allow-empty' ) { $empty = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | ▶ | elsif ( $o eq '--no-verify' || $o eq '-n' || $o eq '-q' || $o eq '--quiet' || $o eq '-s' || $o eq '--signoff' ) { } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/15
$o eq "--no-verify" or $o eq "-n" or $o eq "-q" or $o eq "--quiet" or $o eq "-s" or $o eq "--signoff"
$o eq "--no-verify" or $o eq "-n" or $o eq "-q" or $o eq "--quiet" or $o eq "-s"
$o eq "--no-verify" or $o eq "-n" or $o eq "-q" or $o eq "--quiet"
$o eq "--no-verify" or $o eq "-n" or $o eq "-q"
$o eq "--no-verify" or $o eq "-n"
MC/DC0%0/6
$o eq "--no-verify" or $o eq "-n" or $o eq "-q" or $o eq "--quiet" or $o eq "-s" or $o eq "--signoff"
$o eq "--no-verify"
$o eq "-n"
$o eq "-q"
$o eq "--quiet"
$o eq "-s"
$o eq "--signoff"
Truth table0%0/7
A or B or C or D or E or F
A= $o eq "--no-verify"B= $o eq "-n"C= $o eq "-q"D= $o eq "--quiet"E= $o eq "-s"F= $o eq "--signoff"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 0 | ▶ | elsif ( $o eq '-F' || $o eq '--file' ) { my $f = shift(@x) // ''; my $t = ( $dev->{files} || {} )->{ $f =~ m{\A/} ? $f : "$root/$f" }; return ( "fatal: could not read log file '$f': No such file or directory", 0 ) unless defined $t; push @msg, _text($t) =~ s/\n+\z//r } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/7
$o eq "-F" or $o eq "--file"
shift @x // ""
$$dev{'files'} || {}
MC/DC0%0/2
$o eq "-F" or $o eq "--file"
$o eq "-F"
$o eq "--file"
MC/DC0%0/1
shift @x // ""
shift @x
MC/DC0%0/1
$$dev{'files'} || {}
$$dev{'files'}
Truth table0%0/3
A or B
A= $o eq "-F"B= $o eq "--file"
Truth table0%0/2
A
A= shift @x
Truth table0%0/2
A
A= $$dev{'files'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 0 | else { return ( "error: unknown option `" . ( $o =~ s/\A-+//r ) . "'", 0 ) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 7 | ▶ | if ($all) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 3 | my $w = _work( $dev, $root ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 3 | my $idx = _index($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | ▶ | for my $f ( keys %$idx ) { if ( exists $w->{$f} ) { $idx->{$f} = $w->{$f} } else { delete $idx->{$f} } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 3 | $r->{index} = $idx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 7 | my $head = _head($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 7 | ▶ | my $hc = defined $head ? $r->{commits}{$head} : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | ▶ | if ( !@msg && !( $amend && $noedit ) ) { push @GAPS, 'git commit (Editor)'; return ( 'error: There was a problem with the editor \'editor\'.', 0 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
@msg or $amend and $noedit
$amend and $noedit
MC/DC0%0/3
@msg or $amend and $noedit
@msg
$amend
$noedit
Truth table50%2/4
A or B and C
A= @msgB= $amendC= $noedit
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 7 | my $idx = _index($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 7 | ▶ | my $parent_tree = $amend ? _tree( $r, ( $hc->{parents} || [] )->[0] ) : _tree( $r, $head ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$hc{'parents'} || []
MC/DC0%0/1
$$hc{'parents'} || []
$$hc{'parents'}
Truth table50%1/2
A
A= $$hc{'parents'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 7 | ▶ | if ( !$amend && !$empty && $J->encode($idx) eq $J->encode( _tree( $r, $head ) ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
not $amend || $empty and $J->encode($idx) eq $J->encode(_tree($r, $head))
$amend || $empty
MC/DC0%0/3
not $amend || $empty and $J->encode($idx) eq $J->encode(_tree($r, $head))
$amend
$empty
$J->encode($idx) eq $J->encode(_tree($r, $head))
Truth table50%2/4
not(A || B) and C
A= $amendB= $emptyC= $J->encode($idx) eq $J->encode(_tree($r, $head))
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 0 | my ( undef, $un, $ut ) = _changes( $dev, $root, $r ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 0 | ▶ | return ( join( "\n", "On branch " . ( $r->{branch} // 'HEAD' ), @$un ? 'no changes added to commit (use "git add" and/or "git commit -a")' : @$ut ? 'nothing added to commit but untracked files present (use "git add" to track)' : 'nothing to commit, working tree clean' ), 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/2
$$r{"branch"} // "HEAD"
MC/DC0%0/1
$$r{"branch"} // "HEAD"
$$r{"branch"}
Truth table0%0/2
A
A= $$r{"branch"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 7 | ▶ | return ( 'fatal: You have nothing to amend.', 0 ) if $amend && !$hc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$amend and not $hc
MC/DC0%0/2
$amend and not $hc
$amend
not $hc
Truth table66%2/3
A and not(B)
A= $amendB= not $hc
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 7 | ▶ | my $msg = @msg ? join( "\n\n", @msg ) : $hc->{message}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 7 | ▶ | my $who = $author // ( $amend && !$reset ? $hc->{author} : _who( $dev, $r ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$author // ($amend && !$reset ? $$hc{"author"} : _who($dev, $r))
$amend and not $reset
MC/DC33%1/3
$author // ($amend && !$reset ? $$hc{"author"} : _who($dev, $r))
$author
$amend
not $reset
Truth table50%2/4
A // B and not(C)
A= $authorB= $amendC= not $reset
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 7 | ▶ | $who = "$who <$who>" unless $who =~ /<.*>/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 2 | ▶ | my $id = _mk_commit( $dev, $r, parents => $amend ? [ @{ $hc->{parents} || [] } ] : [ grep {defined} $head ], message => $msg, author => $who, tree => _clone($idx), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
$$hc{'parents'} || []
$amend and not $reset
MC/DC0%0/1
$$hc{'parents'} || []
$$hc{'parents'}
MC/DC50%1/2
$amend and not $reset
$amend
not $reset
Truth table50%1/2
A
A= $$hc{'parents'}
Truth table66%2/3
A and not(B)
A= $amendB= not $reset
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 7 | ▶ | ( $amend && !$reset ? ( date => $hc->{date} ) : () ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 0 | ▶ | if ( defined $r->{branch} ) { $r->{refs}{heads}{ $r->{branch} } = $id } else { $r->{detached} = $id } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 7 | delete $r->{index}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | 7 | my $d = _diff_trees( $parent_tree, $idx, 'name-only' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 7 | my $n = () = split /\n/, $d; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | return ( '[' . ( $r->{branch} // 'detached HEAD' ) . ( defined $head || $amend ? '' : ' (root-commit)' ) . ' ' . _short($id) . '] ' . _subject($msg) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 7 | ▶ | . ( $amend ? "\n Date: " . _date_text( $r->{commits}{$id}{date} ) : '' ) . "\n $n file" . ( $n == 1 ? '' : 's' ) . ' changed', 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition40%2/5
$$r{"branch"} // "detached HEAD"
defined $head or $amend
MC/DC0%0/1
$$r{"branch"} // "detached HEAD"
$$r{"branch"}
MC/DC0%0/2
defined $head or $amend
defined $head
$amend
Truth table50%1/2
A
A= $$r{"branch"}
Truth table33%1/3
A or B
A= defined $headB= $amend
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | # Verweise auf einen Commit wie --decorate: (HEAD -> main, origin/main, tag: v1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 0 | ▶ | sub _deco { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_deco: not called CC=15 SCAR=54.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 0 | my ( $r, $id ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 0 | my @d; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 0 | my $h = _head($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | ▶ | if ( defined $h && $h eq $id ) { push @d, defined $r->{branch} ? "HEAD -> $r->{branch}" : 'HEAD' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
defined $h and $h eq $id
MC/DC0%0/2
defined $h and $h eq $id
defined $h
$h eq $id
Truth table0%0/3
A and B
A= defined $hB= $h eq $id
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 0 | ▶ | push @d, grep { ( $r->{refs}{heads}{$_} // '' ) eq $id && $_ ne ( defined $h && $h eq $id ? $r->{branch} // '' : "\0" ) } sort keys %{ $r->{refs}{heads} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/12
($$r{'refs'}{'heads'}{$_} // '') eq $id && $_ ne (defined $h && $h eq $id ? $$r{'branch'} // '' : "\000")
$$r{"refs"}{"heads"}{$_} // ""
defined $h and $h eq $id
$$r{"branch"} // ""
$$r{'refs'}{'heads'} || {}
MC/DC0%0/2
($$r{'refs'}{'heads'}{$_} // '') eq $id && $_ ne (defined $h && $h eq $id ? $$r{'branch'} // '' : "\000")
$$r{"refs"}{"heads"}{$_}
$_ ne (defined $h && $h eq $id ? $$r{'branch'} // '' : "\000")
MC/DC0%0/2
defined $h and $h eq $id
defined $h
$h eq $id
MC/DC0%0/1
$$r{"branch"} // ""
$$r{"branch"}
MC/DC0%0/1
$$r{'refs'}{'heads'} || {}
$$r{'refs'}{'heads'}
Truth table0%0/3
A && B
A= $$r{"refs"}{"heads"}{$_}B= $_ ne (defined $h && $h eq $id ? $$r{'branch'} // '' : "\000")
Truth table0%0/3
A and B
A= defined $hB= $h eq $id
Truth table0%0/2
A
A= $$r{"branch"}
Truth table0%0/2
A
A= $$r{'refs'}{'heads'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 0 | ▶ | push @d, grep { ( $r->{refs}{remotes}{$_} // '' ) eq $id } sort keys %{ $r->{refs}{remotes} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$$r{"refs"}{"remotes"}{$_} // ""
$$r{'refs'}{'remotes'} || {}
MC/DC0%0/1
$$r{"refs"}{"remotes"}{$_} // ""
$$r{"refs"}{"remotes"}{$_}
MC/DC0%0/1
$$r{'refs'}{'remotes'} || {}
$$r{'refs'}{'remotes'}
Truth table0%0/2
A
A= $$r{"refs"}{"remotes"}{$_}
Truth table0%0/2
A
A= $$r{'refs'}{'remotes'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 0 | ▶ | push @d, map {"tag: $_"} grep { ( $r->{refs}{tags}{$_}{commit} // '' ) eq $id } sort keys %{ $r->{refs}{tags} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$$r{"refs"}{"tags"}{$_}{"commit"} // ""
$$r{'refs'}{'tags'} || {}
MC/DC0%0/1
$$r{"refs"}{"tags"}{$_}{"commit"} // ""
$$r{"refs"}{"tags"}{$_}{"commit"}
MC/DC0%0/1
$$r{'refs'}{'tags'} || {}
$$r{'refs'}{'tags'}
Truth table0%0/2
A
A= $$r{"refs"}{"tags"}{$_}{"commit"}
Truth table0%0/2
A
A= $$r{'refs'}{'tags'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | ▶ | return @d ? ' (' . join( ', ', @d ) . ')' : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | ▶ | sub _ago { my ($t) = @_; my $h = int( ( 1792832400 + 3600 - $t ) / 3600 ); return $h < 1 ? 'vor wenigen Minuten' =~ s/.*/minutes ago/r : $h < 48 ? "$h hours ago" : int( $h / 24 ) . ' days ago' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ago: not called CC=3 SCAR=24.8
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 0 | ▶ | sub _fmt_commit { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fmt_commit: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | my ( $r, $id, $fmt ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 0 | my $c = $r->{commits}{$id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | my ( $an, $ae ) = $c->{author} =~ /\A(.*?)\s*<(.*)>\z/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | my %ph = ( H => $id, h => _short($id), s => _subject( $c->{message} ), an => $an // '', ae => $ae // '', ad => _date_text( $c->{date} ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 0 | ▶ | b => ( $c->{message} =~ /\A[^\n]*\n\n(.*)\z/s ? "$1\n" : '' ), B => "$c->{message}\n", P => join( ' ', @{ $c->{parents} || [] } ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$c{'parents'} || []
MC/DC0%0/1
$$c{'parents'} || []
$$c{'parents'}
Truth table0%0/2
A
A= $$c{'parents'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | ▶ | p => join( ' ', map { _short($_) } @{ $c->{parents} || [] } ), cn => $an // '', ce => $ae // '', cd => _date_text( $c->{date} ), n => "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$$c{'parents'} || []
$an // ""
$ae // ""
MC/DC0%0/1
$$c{'parents'} || []
$$c{'parents'}
MC/DC0%0/1
$an // ""
$an
MC/DC0%0/1
$ae // ""
$ae
Truth table0%0/2
A
A= $$c{'parents'}
Truth table0%0/2
A
A= $an
Truth table0%0/2
A
A= $ae
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | ar => _ago( $c->{date} ), cr => _ago( $c->{date} ), d => _deco( $r, $id ), D => _deco( $r, $id ) =~ s/\A \((.*)\)\z/$1/r, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | ▶ | aI => _iso( $c->{date} ), cI => _iso( $c->{date} ), ai => _iso( $c->{date} ), ci => _iso( $c->{date} ), T => '', t => '', '%' => '%' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/4
$an // ""
$ae // ""
MC/DC0%0/1
$an // ""
$an
MC/DC0%0/1
$ae // ""
$ae
Truth table0%0/2
A
A= $an
Truth table0%0/2
A
A= $ae
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 0 | ( my $o = $fmt ) =~ s/%(an|ae|ad|ar|aI|ai|cn|ce|cd|cr|cI|ci|[HhsbBPpndDTt%])/$ph{$1}/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | return $o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 0 | ▶ | sub _iso { my ($t) = @_; my @g = gmtime( $t + 7200 ); return sprintf '%04d-%02d-%02dT%02d:%02d:%02d+02:00', $g[5] + 1900, $g[4] + 1, @g[ 3, 2, 1, 0 ] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_iso: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 4 | ▶ | sub _log_text { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_log_text: called CC=13 SCAR=30.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 4 | my ( $r, $ids, %o ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 4 | my @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 4 | for my $id (@$ids) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 9 | my $c = $r->{commits}{$id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 9 | ▶ | my $deco = $o{decorate} ? _deco( $r, $id ) : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 0 | ▶ | if ( defined $o{format} ) { push @out, _fmt_commit( $r, $id, $o{format} ); next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 9 | ▶ | if ( $o{oneline} ) { push @out, _short($id) . $deco . ' ' . _subject( $c->{message} ); next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 0 | ▶ | my @l = ( "commit $id$deco", ( @{ $c->{parents} || [] } > 1 ? 'Merge: ' . join( ' ', map { _short($_) } @{ $c->{parents} } ) : () ), "Author: $c->{author}", 'Date: ' . _date_text( $c->{date} ), '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$c{'parents'} || []
MC/DC0%0/1
$$c{'parents'} || []
$$c{'parents'}
Truth table50%1/2
A
A= $$c{'parents'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 1 | ▶ | map( {" $_"} split /\n/, $c->{message} ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 1 | ▶ | push @l, '', _diff_trees( _tree( $r, ( $c->{parents} || [] )->[0] ), $c->{tree}, 'stat' ) if $o{stat}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$c{'parents'} || []
MC/DC0%0/1
$$c{'parents'} || []
$$c{'parents'}
Truth table50%1/2
A
A= $$c{'parents'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 1 | ▶ | push @l, '', _diff_trees( _tree( $r, ( $c->{parents} || [] )->[0] ), $c->{tree}, 'name-only' ) if $o{names}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$$c{'parents'} || []
MC/DC0%0/1
$$c{'parents'} || []
$$c{'parents'}
Truth table0%0/2
A
A= $$c{'parents'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 1 | ▶ | push @l, '', _diff_trees( _tree( $r, ( $c->{parents} || [] )->[0] ), $c->{tree} ) if $o{patch}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$$c{'parents'} || []
MC/DC0%0/1
$$c{'parents'} || []
$$c{'parents'}
Truth table0%0/2
A
A= $$c{'parents'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 1 | push @out, join( "\n", @l ) . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 4 | return join( "\n", @out ) =~ s/\n+\z//r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 3 | ▶ | sub _g_log { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_log: called CC=46 SCAR=61.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 3 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 3 | my ( %o, @revs, @paths ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 3 | my @x = @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 3 | ▶ | while (@x) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 5 | my $v = shift @x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 5 | ▶ | if ( $v eq '--oneline' ) { $o{oneline} = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 13 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 1 | elsif ( $v =~ /\A-(\d+)\z/ ) { $o{n} = $1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 0 | ▶ | elsif ( $v eq '-n' || $v eq '--max-count' ) { $o{n} = shift @x } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$v eq "-n" or $v eq "--max-count"
MC/DC0%0/2
$v eq "-n" or $v eq "--max-count"
$v eq "-n"
$v eq "--max-count"
Truth table33%1/3
A or B
A= $v eq "-n"B= $v eq "--max-count"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | elsif ( $v =~ /\A(?:-n|--max-count=)(\d+)\z/ ) { $o{n} = $1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 0 | ▶ | elsif ( $v =~ /\A--(?:format|pretty)=(?:format:|tformat:)?(.*)\z/s ) { my $f = $1; $o{format} = $f eq 'oneline' ? undef : $f; $o{oneline} = 1 if $f eq 'oneline'; $o{format} = '%H%nAuthor: %an <%ae>%n%n %s' if $f =~ /\A(?:full|fuller|medium)\z/ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 0 | elsif ( $v eq '--stat' ) { $o{stat} = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 0 | ▶ | elsif ( $v eq '--name-only' || $v eq '--name-status' ) { $o{names} = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$v eq "--name-only" or $v eq "--name-status"
MC/DC0%0/2
$v eq "--name-only" or $v eq "--name-status"
$v eq "--name-only"
$v eq "--name-status"
Truth table33%1/3
A or B
A= $v eq "--name-only"B= $v eq "--name-status"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 0 | ▶ | elsif ( $v eq '-p' || $v eq '--patch' ) { $o{patch} = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$v eq "-p" or $v eq "--patch"
MC/DC0%0/2
$v eq "-p" or $v eq "--patch"
$v eq "-p"
$v eq "--patch"
Truth table33%1/3
A or B
A= $v eq "-p"B= $v eq "--patch"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 1 | elsif ( $v eq '--all' ) { $o{all} = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 0 | elsif ( $v eq '--' ) { @paths = @x; last } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 0 | elsif ( $v =~ /\A--decorate(?:=\w+)?\z/ ) { $o{decorate} = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 0 | ▶ | elsif ( $v =~ /\A--(?:graph|no-decorate|abbrev-commit|no-merges|first-parent|reverse|color|no-color|date=\S+)\z/ ) { $o{reverse} = 1 if $v eq '--reverse' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 0 | elsif ( $v =~ /\A-/ ) { return ( "fatal: unrecognized argument: $v", 0 ) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 0 | else { push @revs, $v } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 3 | my @ids; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 3 | ▶ | if ( $o{all} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 1 | my %s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 0 | ▶ | my @tips = ( values %{ $r->{refs}{heads} || {} }, values %{ $r->{refs}{remotes} || {} }, map { $_->{commit} } values %{ $r->{refs}{tags} || {} } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
$$r{'refs'}{'heads'} || {}
$$r{'refs'}{'remotes'} || {}
$$r{'refs'}{'tags'} || {}
MC/DC0%0/1
$$r{'refs'}{'heads'} || {}
$$r{'refs'}{'heads'}
MC/DC0%0/1
$$r{'refs'}{'remotes'} || {}
$$r{'refs'}{'remotes'}
MC/DC0%0/1
$$r{'refs'}{'tags'} || {}
$$r{'refs'}{'tags'}
Truth table50%1/2
A
A= $$r{'refs'}{'heads'}
Truth table50%1/2
A
A= $$r{'refs'}{'remotes'}
Truth table50%1/2
A
A= $$r{'refs'}{'tags'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 1 | @ids = grep { !$s{$_}++ } map { _range( $r, undef, $_ ) } @tips; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 1 | @ids = _newest_first( $r, @ids ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 2 | my ( $from, $to ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 2 | ▶ | if ( @revs && $revs[0] =~ /\A(.*?)\.\.(.*)\z/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@revs and $revs[0] =~ /\A(.*?)\.\.(.*)\z/
MC/DC0%0/2
@revs and $revs[0] =~ /\A(.*?)\.\.(.*)\z/
@revs
$revs[0] =~ /\A(.*?)\.\.(.*)\z/
Truth table33%1/3
A and B
A= @revsB= $revs[0] =~ /\A(.*?)\.\.(.*)\z/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 0 | ( $from, $to ) = ( $1, $2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 0 | ▶ | $from = _rev( $r, length $from ? $from : 'HEAD' ) // return ( "fatal: ambiguous argument '$revs[0]': unknown revision or path not in the working tree.", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
_rev($r, length $from ? $from : "HEAD") // (return "fatal: ambiguous argument '$revs[0]': unknown revision or path not in the working tree.", 0)
MC/DC0%0/1
_rev($r, length $from ? $from : "HEAD") // (return "fatal: ambiguous argument '$revs[0]': unknown revision or path not in the working tree.", 0)
_rev($r, length $from ? $from : "HEAD")
Truth table0%0/2
A
A= _rev($r, length $from ? $from : "HEAD")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | 0 | ▶ | $to = _rev( $r, length $to ? $to : 'HEAD' ) // return ( "fatal: ambiguous argument '$revs[0]': unknown revision or path not in the working tree.", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
_rev($r, length $to ? $to : "HEAD") // (return "fatal: ambiguous argument '$revs[0]': unknown revision or path not in the working tree.", 0)
MC/DC0%0/1
_rev($r, length $to ? $to : "HEAD") // (return "fatal: ambiguous argument '$revs[0]': unknown revision or path not in the working tree.", 0)
_rev($r, length $to ? $to : "HEAD")
Truth table0%0/2
A
A= _rev($r, length $to ? $to : "HEAD")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 2 | ▶ | $to = _rev( $r, $revs[0] // 'HEAD' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$revs[0] // "HEAD"
MC/DC0%0/1
$revs[0] // "HEAD"
$revs[0]
Truth table50%1/2
A
A= $revs[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 2 | ▶ | return ( "fatal: your current branch '" . ( $r->{branch} // '' ) . "' does not have any commits yet", 0 ) if !defined $to && !@revs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
defined $to or @revs
$$r{"branch"} // ""
MC/DC0%0/2
defined $to or @revs
defined $to
@revs
MC/DC0%0/1
$$r{"branch"} // ""
$$r{"branch"}
Truth table33%1/3
A or B
A= defined $toB= @revs
Truth table0%0/2
A
A= $$r{"branch"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 2 | ▶ | return ( "fatal: ambiguous argument '$revs[0]': unknown revision or path not in the working tree.", 0 ) unless defined $to; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 2 | @ids = reverse _range( $r, $from, $to ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 3 | ▶ | if (@paths) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 0 | my @rel = _paths( $root, $CWD, @paths ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 0 | ▶ | @ids = grep { my $c = $r->{commits}{$_}; my $p = _tree( $r, ( $c->{parents} || [] )->[0] ); my $t = $c->{tree}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$c{'parents'} || []
MC/DC0%0/1
$$c{'parents'} || []
$$c{'parents'}
Truth table0%0/2
A
A= $$c{'parents'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | ▶ | grep { my $q = $_; grep { ( $p->{$_} // "\0" ) ne ( $t->{$_} // "\0" ) } _match_paths( { %$p, %$t }, $q // "\0" ) } @rel } @ids; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$$p{$_} // "\0"
$$t{$_} // "\0"
$q // "\0"
MC/DC0%0/1
$$p{$_} // "\0"
$$p{$_}
MC/DC0%0/1
$$t{$_} // "\0"
$$t{$_}
MC/DC0%0/1
$q // "\0"
$q
Truth table0%0/2
A
A= $$p{$_}
Truth table0%0/2
A
A= $$t{$_}
Truth table0%0/2
A
A= $q
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 3 | ▶ | @ids = @ids[ 0 .. $o{n} - 1 ] if defined $o{n} && $o{n} =~ /\A\d+\z/ && @ids > $o{n}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
defined $o{"n"} and $o{"n"} =~ /\A\d+\z/ and @ids > $o{"n"}
defined $o{"n"} and $o{"n"} =~ /\A\d+\z/
MC/DC33%1/3
defined $o{"n"} and $o{"n"} =~ /\A\d+\z/ and @ids > $o{"n"}
defined $o{"n"}
$o{"n"} =~ /\A\d+\z/
@ids > $o{"n"}
Truth table50%2/4
A and B and C
A= defined $o{"n"}B= $o{"n"} =~ /\A\d+\z/C= @ids > $o{"n"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 3 | ▶ | @ids = reverse @ids if $o{reverse}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 3 | return ( _log_text( $r, \@ids, %o ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 1 | ▶ | sub _g_show { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_show: called CC=17 SCAR=38.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 1 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 1 | my @revs = grep { !/\A-/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 1 | my %o = ( patch => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | ▶ | for (@$a) { if ( $_ eq '--stat' ) { %o = ( stat => 1 ) } elsif ( $_ eq '--name-only' ) { %o = ( names => 1 ) } elsif (/\A--(?:format|pretty)=(?:format:)?(.*)\z/) { $o{format} = $1; delete $o{patch} } elsif ( $_ eq '--oneline' ) { $o{oneline} = 1 } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 1 | my @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 1 | ▶ | for my $spec ( @revs ? @revs : ('HEAD') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 1 | ▶ | if ( $spec =~ /\A(.*?):(.+)\z/ ) { # rev:pfad | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 0 | ▶ | my $id = _rev( $r, $1 ) // return ( "fatal: invalid object name '$1'.", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
_rev($r, $1) // (return "fatal: invalid object name '$1'.", 0)
MC/DC0%0/1
_rev($r, $1) // (return "fatal: invalid object name '$1'.", 0)
_rev($r, $1)
Truth table0%0/2
A
A= _rev($r, $1)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | my $t = _tree( $r, $id ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | ▶ | return ( "fatal: path '$2' does not exist in '$1'", 0 ) unless exists $t->{$2}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | push @out, $t->{$2} =~ s/\n\z//r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 1 | ▶ | my $tag = ( $r->{refs}{tags} || {} )->{$spec}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{'refs'}{'tags'} || {}
MC/DC0%0/1
$$r{'refs'}{'tags'} || {}
$$r{'refs'}{'tags'}
Truth table50%1/2
A
A= $$r{'refs'}{'tags'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 1 | ▶ | my $id = _rev( $r, $spec ) // return ( "fatal: ambiguous argument '$spec': unknown revision or path not in the working tree.", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
_rev($r, $spec) // (return "fatal: ambiguous argument '${spec}': unknown revision or path not in the working tree.", 0)
MC/DC0%0/1
_rev($r, $spec) // (return "fatal: ambiguous argument '${spec}': unknown revision or path not in the working tree.", 0)
_rev($r, $spec)
Truth table50%1/2
A
A= _rev($r, $spec)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 1 | ▶ | push @out, "tag $spec\nTagger: " . ( $tag->{tagger} // '' ) . "\n\n" . ( $tag->{message} // '' ) . "\n" if $tag && $tag->{annotated}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition42%3/7
$tag and $$tag{"annotated"}
$$tag{"tagger"} // ""
$$tag{"message"} // ""
MC/DC0%0/2
$tag and $$tag{"annotated"}
$tag
$$tag{"annotated"}
MC/DC0%0/1
$$tag{"tagger"} // ""
$$tag{"tagger"}
MC/DC0%0/1
$$tag{"message"} // ""
$$tag{"message"}
Truth table33%1/3
A and B
A= $tagB= $$tag{"annotated"}
Truth table50%1/2
A
A= $$tag{"tagger"}
Truth table50%1/2
A
A= $$tag{"message"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 1 | push @out, _log_text( $r, [$id], %o ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 1 | return ( join( "\n", @out ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | 0 | ▶ | sub _g_diff { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_diff: not called CC=11 SCAR=48.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 0 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 0 | my $cached = grep { /\A--(?:cached|staged)\z/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 0 | ▶ | my ($mode) = map { /\A--(stat|name-only)\z/ ? $1 : () } @$a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 0 | my @revs = grep { !/\A-/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 0 | my ( $x, $y ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 0 | ▶ | if ( @revs && $revs[0] =~ /\A(.+?)\.\.\.?(.+)\z/ ) { $x = _tree( $r, _rev( $r, $1 ) ); $y = _tree( $r, _rev( $r, $2 ) ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition0%0/3
@revs and $revs[0] =~ /\A(.+?)\.\.\.?(.+)\z/
MC/DC0%0/2
@revs and $revs[0] =~ /\A(.+?)\.\.\.?(.+)\z/
@revs
$revs[0] =~ /\A(.+?)\.\.\.?(.+)\z/
Truth table0%0/3
A and B
A= @revsB= $revs[0] =~ /\A(.+?)\.\.\.?(.+)\z/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 0 | ▶ | elsif ( @revs >= 2 && defined _rev( $r, $revs[0] ) && defined _rev( $r, $revs[1] ) ) { $x = _tree( $r, _rev( $r, $revs[0] ) ); $y = _tree( $r, _rev( $r, $revs[1] ) ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
@revs >= 2 and defined _rev($r, $revs[0]) and defined _rev($r, $revs[1])
@revs >= 2 and defined _rev($r, $revs[0])
MC/DC0%0/3
@revs >= 2 and defined _rev($r, $revs[0]) and defined _rev($r, $revs[1])
@revs >= 2
defined _rev($r, $revs[0])
defined _rev($r, $revs[1])
Truth table0%0/4
A and B and C
A= @revs >= 2B= defined _rev($r, $revs[0])C= defined _rev($r, $revs[1])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | 0 | ▶ | elsif ( @revs && defined _rev( $r, $revs[0] ) ) { $x = _tree( $r, _rev( $r, $revs[0] ) ); $y = $cached ? _index($r) : _work_tracked( $dev, $root, $r ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@revs and defined _rev($r, $revs[0])
MC/DC0%0/2
@revs and defined _rev($r, $revs[0])
@revs
defined _rev($r, $revs[0])
Truth table0%0/3
A and B
A= @revsB= defined _rev($r, $revs[0])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 0 | elsif ($cached) { $x = _tree( $r, _head($r) ); $y = _index($r) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 0 | else { $x = _index($r); $y = _work_tracked( $dev, $root, $r ) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 0 | return ( _diff_trees( $x, $y, $mode ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | ▶ | sub _work_tracked { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_work_tracked: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 0 | my ( $dev, $root, $r ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 0 | my $w = _work( $dev, $root ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 0 | my $idx = _index($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 0 | ▶ | return { map { exists $w->{$_} ? ( $_ => $w->{$_} ) : () } keys %$idx }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 0 | ▶ | sub _g_ls_files { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_ls_files: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | 0 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | 0 | return ( join( "\n", sort keys %{ _index($r) } ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 0 | ▶ | sub _g_branch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_branch: not called CC=34 SCAR=70.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 0 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 0 | my @p = grep { !/\A-/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 0 | ▶ | if ( @p && !grep { /\A-[dDm]/ } @$a ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@p and not grep({/\A-[dDm]/;} @$a)
MC/DC0%0/2
@p and not grep({/\A-[dDm]/;} @$a)
@p
not grep({/\A-[dDm]/;} @$a)
Truth table0%0/3
A and not(B)
A= @pB= not grep({/\A-[dDm]/;} @$a)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 0 | ▶ | my $id = _rev( $r, $p[1] // 'HEAD' ) // return ( "fatal: not a valid object name: '$p[1]'", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
_rev($r, $p[1] // "HEAD") // (return "fatal: not a valid object name: '$p[1]'", 0)
$p[1] // "HEAD"
MC/DC0%0/1
_rev($r, $p[1] // "HEAD") // (return "fatal: not a valid object name: '$p[1]'", 0)
_rev($r, $p[1] // "HEAD")
MC/DC0%0/1
$p[1] // "HEAD"
$p[1]
Truth table0%0/2
A
A= _rev($r, $p[1] // "HEAD")
Truth table0%0/2
A
A= $p[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 0 | ▶ | my $force = grep { $_ eq '-f' || $_ eq '--force' } @$a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$_ eq '-f' || $_ eq '--force'
MC/DC0%0/2
$_ eq '-f' || $_ eq '--force'
$_ eq '-f'
$_ eq '--force'
Truth table0%0/3
A || B
A= $_ eq '-f'B= $_ eq '--force'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 0 | ▶ | return ( "fatal: a branch named '$p[0]' already exists", 0 ) if exists $r->{refs}{heads}{ $p[0] } && !$force; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $$r{"refs"}{"heads"}{$p[0]} and not $force
MC/DC0%0/2
exists $$r{"refs"}{"heads"}{$p[0]} and not $force
exists $$r{"refs"}{"heads"}{$p[0]}
not $force
Truth table0%0/3
A and not(B)
A= exists $$r{"refs"}{"heads"}{$p[0]}B= not $force
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 0 | ▶ | return ( "fatal: cannot force update the branch '$p[0]' used by worktree at '$root'", 0 ) if $force && ( $r->{branch} // '' ) eq $p[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$force and ($$r{"branch"} // "") eq $p[0]
$$r{"branch"} // ""
MC/DC0%0/2
$force and ($$r{"branch"} // "") eq $p[0]
$force
$$r{"branch"}
Truth table0%0/3
A and B
A= $forceB= $$r{"branch"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 0 | $r->{refs}{heads}{ $p[0] } = $id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | 0 | return ( '', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 0 | ▶ | if ( grep { /\A-[dD]\z/ } @$a ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 0 | ▶ | my $n = $p[0] // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$p[0] // ""
MC/DC0%0/1
$p[0] // ""
$p[0]
Truth table0%0/2
A
A= $p[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 0 | ▶ | return ( "error: branch '$n' not found.", 0 ) unless exists $r->{refs}{heads}{$n}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 0 | ▶ | return ( "error: Cannot delete branch '$n' checked out at '$root'", 0 ) if ( $r->{branch} // '' ) eq $n; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$$r{"branch"} // ""
MC/DC0%0/1
$$r{"branch"} // ""
$$r{"branch"}
Truth table0%0/2
A
A= $$r{"branch"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 0 | my $id = delete $r->{refs}{heads}{$n}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 0 | return ( "Deleted branch $n (was " . _short($id) . ').', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 0 | ▶ | my $v = grep { /\A-vv?\z/ || $_ eq '--verbose' } @$a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
/\A-vv?\z/ || $_ eq '--verbose'
MC/DC0%0/2
/\A-vv?\z/ || $_ eq '--verbose'
/\A-vv?\z/
$_ eq '--verbose'
Truth table0%0/3
A || B
A= /\A-vv?\z/B= $_ eq '--verbose'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 0 | my $vv = grep { $_ eq '-vv' } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 0 | my $w = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 0 | ▶ | for ( keys %{ $r->{refs}{heads} || {} } ) { $w = length if length > $w } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$$r{'refs'}{'heads'} || {}
MC/DC0%0/1
$$r{'refs'}{'heads'} || {}
$$r{'refs'}{'heads'}
Truth table0%0/2
A
A= $$r{'refs'}{'heads'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | my @l = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | 0 | my $b = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 0 | ▶ | my $cur = ( $r->{branch} // '' ) eq $b; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$r{"branch"} // ""
MC/DC0%0/1
$$r{"branch"} // ""
$$r{"branch"}
Truth table0%0/2
A
A= $$r{"branch"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 0 | my $id = $r->{refs}{heads}{$b}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | 0 | my $up = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | ▶ | if ( $vv && exists( ( $r->{refs}{remotes} || {} )->{"origin/$b"} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$vv and exists(($$r{"refs"}{"remotes"} || {})->{"origin/$b"})
$$r{'refs'}{'remotes'} || {}
MC/DC0%0/2
$vv and exists(($$r{"refs"}{"remotes"} || {})->{"origin/$b"})
$vv
$$r{'refs'}{'remotes'}
Truth table0%0/3
A and B
A= $vvB= $$r{'refs'}{'remotes'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | 0 | my $u = $r->{refs}{remotes}{"origin/$b"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 0 | my $ah = () = _range( $r, $u, $id ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | 0 | my $be = () = _range( $r, $id, $u ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 0 | ▶ | $up = " [origin/$b" . ( $ah && $be ? ": ahead $ah, behind $be" : $ah ? ": ahead $ah" : $be ? ": behind $be" : '' ) . ']'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/3
$ah and $be
MC/DC0%0/2
$ah and $be
$ah
$be
Truth table0%0/3
A and B
A= $ahB= $be
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | 0 | ▶ | ( $cur ? '* ' : ' ' ) . ( $v ? sprintf( "%-${w}s %s%s %s", $b, _short($id), $up, _subject( $r->{commits}{$id}{message} ) ) : $b ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | 0 | ▶ | } sort keys %{ $r->{refs}{heads} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$r{'refs'}{'heads'} || {}
MC/DC0%0/1
$$r{'refs'}{'heads'} || {}
$$r{'refs'}{'heads'}
Truth table0%0/2
A
A= $$r{'refs'}{'heads'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 0 | ▶ | unshift @l, '* (HEAD detached at ' . _short( $r->{detached} ) . ')' unless defined $r->{branch}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 0 | ▶ | push @l, map {" remotes/$_"} sort keys %{ $r->{refs}{remotes} || {} } if grep { /\A-(?:a|r|-all|-remotes)\z/ } @$a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$$r{'refs'}{'remotes'} || {}
MC/DC0%0/1
$$r{'refs'}{'remotes'} || {}
$$r{'refs'}{'remotes'}
Truth table0%0/2
A
A= $$r{'refs'}{'remotes'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | 0 | return ( join( "\n", @l ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | # HEAD auf einen anderen Commit setzen und Index/Arbeitsbaum nachziehen (nur verfolgte Dateien) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 0 | ▶ | sub _move_head { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_move_head: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 0 | my ( $dev, $root, $r, $id, $mode ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | 0 | my $old = _tree( $r, _head($r) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 0 | ▶ | $r->{index} = _index($r) if $mode eq 'soft'; # der Index bleibt, wie er war | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 0 | ▶ | if ( defined $r->{branch} ) { $r->{refs}{heads}{ $r->{branch} } = $id } else { $r->{detached} = $id } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 0 | ▶ | return if $mode eq 'soft'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | 0 | my $new = _tree( $r, $id ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | 0 | delete $r->{index}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 0 | ▶ | if ( $mode eq 'hard' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 0 | my $w = _work( $dev, $root ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 0 | my %tracked = map { $_ => 1 } keys %$old; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | 0 | _set_work( $dev, $root, { map { $_ => 1 } grep { $tracked{$_} } keys %$w }, _clone($new) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 17 | ▶ | sub _dirty { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dirty: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 17 | my ( $dev, $root, $r ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 17 | my ( $st, $un ) = _changes( $dev, $root, $r ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 17 | ▶ | return @$st || @$un; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
@$st || @$un
MC/DC50%1/2
@$st || @$un
@$st
@$un
Truth table66%2/3
A || B
A= @$stB= @$un
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 2 | ▶ | sub _g_checkout { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_checkout: called CC=25 SCAR=53.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 2 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 2 | my @x = @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 2 | ▶ | if ( my ($i) = grep { $x[$_] eq '--' } 0 .. $#x ) { return _g_restore( $dev, $root, $r, [ @x[ $i + 1 .. $#x ] ] ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 1 | ▶ | my $create = grep { $_ eq '-b' || $_ eq '-c' || $_ eq '-B' } @x; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
$_ eq '-b' || $_ eq '-c' || $_ eq '-B'
$_ eq "-b" or $_ eq "-c"
MC/DC33%1/3
$_ eq '-b' || $_ eq '-c' || $_ eq '-B'
$_ eq "-b"
$_ eq "-c"
$_ eq '-B'
Truth table50%2/4
A or B || C
A= $_ eq "-b"B= $_ eq "-c"C= $_ eq '-B'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | 1 | my @p = grep { !/\A-/ } @x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 1 | ▶ | my $name = $p[0] // return ( 'error: switch `b\' requires a value', 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$p[0] // (return "error: switch `b' requires a value", 0)
MC/DC0%0/1
$p[0] // (return "error: switch `b' requires a value", 0)
$p[0]
Truth table50%1/2
A
A= $p[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | 1 | ▶ | if ($create) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 1 | ▶ | return ( "fatal: a branch named '$name' already exists", 0 ) if exists $r->{refs}{heads}{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | 1 | ▶ | my $id = _rev( $r, $p[1] // 'HEAD' ) // return ( "fatal: '$p[1]' is not a commit and a branch '$name' cannot be created from it", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
_rev($r, $p[1] // "HEAD") // (return "fatal: '$p[1]' is not a commit and a branch '${name}' cannot be created from it", 0)
$p[1] // "HEAD"
MC/DC0%0/1
_rev($r, $p[1] // "HEAD") // (return "fatal: '$p[1]' is not a commit and a branch '${name}' cannot be created from it", 0)
_rev($r, $p[1] // "HEAD")
MC/DC0%0/1
$p[1] // "HEAD"
$p[1]
Truth table50%1/2
A
A= _rev($r, $p[1] // "HEAD")
Truth table50%1/2
A
A= $p[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 1 | my $dirty = _dirty( $dev, $root, $r ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | 1 | $r->{refs}{heads}{$name} = $id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 1 | my $old = _head($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | 1 | $r->{branch} = $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 1 | delete $r->{detached}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 0 | ▶ | if ( $id ne ( $old // '' ) ) { return ( "error: Your local changes would be overwritten by checkout.", 0 ) if $dirty; _switch_tree( $dev, $root, $r, $old, $id ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%1/2
$old // ""
MC/DC0%0/1
$old // ""
$old
Truth table50%1/2
A
A= $old
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | 1 | return ( "Switched to a new branch '$name'", 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 0 | ▶ | if ( !exists $r->{refs}{heads}{$name} && exists( ( $r->{refs}{remotes} || {} )->{"origin/$name"} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
not exists $$r{"refs"}{"heads"}{$name} and exists(($$r{"refs"}{"remotes"} || {})->{"origin/$name"})
$$r{'refs'}{'remotes'} || {}
MC/DC0%0/2
not exists $$r{"refs"}{"heads"}{$name} and exists(($$r{"refs"}{"remotes"} || {})->{"origin/$name"})
not exists $$r{"refs"}{"heads"}{$name}
$$r{'refs'}{'remotes'}
Truth table0%0/3
not(A) and B
A= not exists $$r{"refs"}{"heads"}{$name}B= $$r{'refs'}{'remotes'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 0 | my $old = _head($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | 0 | ▶ | return ( "error: Your local changes to the following files would be overwritten by checkout.\nAborting", 0 ) if _dirty( $dev, $root, $r ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 0 | $r->{refs}{heads}{$name} = $r->{refs}{remotes}{"origin/$name"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | 0 | $r->{branch} = $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | 0 | _switch_tree( $dev, $root, $r, $old, $r->{refs}{heads}{$name} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 0 | return ( "branch '$name' set up to track 'origin/$name'.\nSwitched to a new branch '$name'", 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 0 | ▶ | if ( exists $r->{refs}{heads}{$name} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | 0 | ▶ | return ( "Already on '$name'", 1 ) if ( $r->{branch} // '' ) eq $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$$r{"branch"} // ""
MC/DC0%0/1
$$r{"branch"} // ""
$$r{"branch"}
Truth table0%0/2
A
A= $$r{"branch"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | 0 | my $old = _head($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | return ( "error: Your local changes to the following files would be overwritten by checkout.\nPlease commit your changes or stash them before you switch branches.\nAborting", 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | 0 | ▶ | if _dirty( $dev, $root, $r ) && ( $old // '' ) ne $r->{refs}{heads}{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
_dirty($dev, $root, $r) and ($old // "") ne $$r{"refs"}{"heads"}{$name}
$old // ""
MC/DC0%0/2
_dirty($dev, $root, $r) and ($old // "") ne $$r{"refs"}{"heads"}{$name}
_dirty($dev, $root, $r)
$old
Truth table0%0/3
A and B
A= _dirty($dev, $root, $r)B= $old
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | 0 | $r->{branch} = $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 0 | delete $r->{detached}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 0 | _switch_tree( $dev, $root, $r, $old, $r->{refs}{heads}{$name} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 0 | return ( "Switched to branch '$name'", 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 0 | my $id = _rev( $r, $name ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | 0 | ▶ | if ( defined $id ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | 0 | ▶ | return ( "error: Your local changes would be overwritten by checkout.\nAborting", 0 ) if _dirty( $dev, $root, $r ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | 0 | my $old = _head($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | 0 | delete $r->{branch}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 0 | $r->{detached} = $id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 0 | _switch_tree( $dev, $root, $r, $old, $id ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | 0 | return ( "Note: switching to '$name'.\n\nYou are in 'detached HEAD' state.\nHEAD is now at " . _short($id) . ' ' . _subject( $r->{commits}{$id}{message} ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | 0 | ▶ | return _g_restore( $dev, $root, $r, \@p ) if grep { exists _work( $dev, $root )->{$_} } _paths( $root, $CWD, @p ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | 0 | return ( "error: pathspec '$name' did not match any file(s) known to git", 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 0 | ▶ | sub _g_switch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_switch: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | 0 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | 0 | ▶ | return _g_checkout( $dev, $root, $r, [ map { $_ eq '-c' || $_ eq '--create' ? '-b' : $_ } grep { $_ ne '--detach' } @$a ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_ eq "-c" or $_ eq "--create"
MC/DC0%0/2
$_ eq "-c" or $_ eq "--create"
$_ eq "-c"
$_ eq "--create"
Truth table0%0/3
A or B
A= $_ eq "-c"B= $_ eq "--create"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | 7 | ▶ | sub _switch_tree { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_switch_tree: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | 7 | my ( $dev, $root, $r, $old, $new ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | 7 | my $ot = _tree( $r, $old ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | 7 | my $nt = _tree( $r, $new ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 7 | delete $r->{index}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | 7 | my $w = _work( $dev, $root ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 7 | _set_work( $dev, $root, { map { $_ => 1 } grep { exists $ot->{$_} } keys %$w }, _clone($nt) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 7 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | 0 | ▶ | sub _g_reset { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_reset: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | 0 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | 0 | ▶ | my ($mode) = map { /\A--(soft|mixed|hard)\z/ ? $1 : () } @$a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 0 | my @p = grep { !/\A-/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | 0 | ▶ | if ( !$mode && @p && !defined _rev( $r, $p[0] ) ) { # reset pfad: aus dem Index nehmen | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not $mode and @p and not defined _rev($r, $p[0])
not $mode and @p
MC/DC0%0/3
not $mode and @p and not defined _rev($r, $p[0])
not $mode
@p
not defined _rev($r, $p[0])
Truth table0%0/4
not(A) and B and not(C)
A= not $modeB= @pC= not defined _rev($r, $p[0])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | 0 | return _g_restore( $dev, $root, $r, [ '--staged', @p ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | 0 | ▶ | $mode //= 'mixed'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$mode //= "mixed"
MC/DC0%0/1
$mode //= "mixed"
$mode
Truth table0%0/2
A
A= $mode
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 0 | ▶ | my $id = _rev( $r, $p[0] // 'HEAD' ) // return ( "fatal: ambiguous argument '$p[0]': unknown revision or path not in the working tree.", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
_rev($r, $p[0] // "HEAD") // (return "fatal: ambiguous argument '$p[0]': unknown revision or path not in the working tree.", 0)
$p[0] // "HEAD"
MC/DC0%0/1
_rev($r, $p[0] // "HEAD") // (return "fatal: ambiguous argument '$p[0]': unknown revision or path not in the working tree.", 0)
_rev($r, $p[0] // "HEAD")
MC/DC0%0/1
$p[0] // "HEAD"
$p[0]
Truth table0%0/2
A
A= _rev($r, $p[0] // "HEAD")
Truth table0%0/2
A
A= $p[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | 0 | _move_head( $dev, $root, $r, $id, $mode ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | 0 | ▶ | return ( $mode eq 'hard' ? 'HEAD is now at ' . _short($id) . ' ' . _subject( $r->{commits}{$id}{message} ) : '', 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | 3 | ▶ | sub _g_tag { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_tag: called CC=31 SCAR=50.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | 3 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | 3 | my ( $ann, $msg, $del, $list, $force ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | 3 | my @p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | 3 | my @x = @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | 3 | ▶ | while (@x) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 9 | my $o = shift @x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | 9 | ▶ | if ( $o eq '-a' || $o eq '--annotate' ) { $ann = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 10 branches
Condition66%2/3
$o eq "-a" or $o eq "--annotate"
MC/DC50%1/2
$o eq "-a" or $o eq "--annotate"
$o eq "-a"
$o eq "--annotate"
Truth table66%2/3
A or B
A= $o eq "-a"B= $o eq "--annotate"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | 0 | elsif ( $o eq '-s' ) { $ann = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 2 | elsif ( $o eq '-m' ) { $msg = shift @x; $ann = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 0 | elsif ( $o =~ /\A-m(.+)\z/s ) { $msg = $1; $ann = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | 0 | elsif ( $o eq '-am' ) { $msg = shift @x; $ann = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | 0 | ▶ | elsif ( $o eq '-d' || $o eq '--delete' ) { $del = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$o eq "-d" or $o eq "--delete"
MC/DC0%0/2
$o eq "-d" or $o eq "--delete"
$o eq "-d"
$o eq "--delete"
Truth table33%1/3
A or B
A= $o eq "-d"B= $o eq "--delete"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | 0 | ▶ | elsif ( $o eq '-l' || $o eq '--list' ) { $list = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$o eq "-l" or $o eq "--list"
MC/DC0%0/2
$o eq "-l" or $o eq "--list"
$o eq "-l"
$o eq "--list"
Truth table33%1/3
A or B
A= $o eq "-l"B= $o eq "--list"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | 0 | ▶ | elsif ( $o eq '-f' || $o eq '--force' ) { $force = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$o eq "-f" or $o eq "--force"
MC/DC0%0/2
$o eq "-f" or $o eq "--force"
$o eq "-f"
$o eq "--force"
Truth table33%1/3
A or B
A= $o eq "-f"B= $o eq "--force"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | 0 | elsif ( $o =~ /\A-n\d*\z/ ) { $list = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | 0 | elsif ( $o =~ /\A-/ ) { return ( "error: unknown option `" . ( $o =~ s/\A-+//r ) . "'", 0 ) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 5 | else { push @p, $o } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | 3 | ▶ | my $t = $r->{refs}{tags} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{"refs"}{"tags"} ||= {}
MC/DC0%0/1
$$r{"refs"}{"tags"} ||= {}
$$r{"refs"}{"tags"}
Truth table50%1/2
A
A= $$r{"refs"}{"tags"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | 3 | ▶ | if ( $del ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 0 | my @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | 0 | ▶ | for my $n (@p) { return ( "error: tag '$n' not found.", 0 ) unless $t->{$n}; push @out, "Deleted tag '$n' (was " . _short( $t->{$n}{commit} ) . ')'; delete $t->{$n} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 0 | return ( join( "\n", @out ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | 0 | ▶ | if ( $list || !@p ) { return ( join( "\n", grep { !@p || _glob_match( $p[0], $_ ) || $_ eq $p[0] } sort keys %$t ), 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition11%1/9
$list or not @p
!@p || _glob_match($p[0], $_) || $_ eq $p[0]
not @p or _glob_match($p[0], $_)
MC/DC0%0/2
$list or not @p
$list
not @p
MC/DC0%0/3
!@p || _glob_match($p[0], $_) || $_ eq $p[0]
not @p
_glob_match($p[0], $_)
$_ eq $p[0]
Truth table33%1/3
A or not(B)
A= $listB= not @p
Truth table0%0/4
not(A) or B || C
A= not @pB= _glob_match($p[0], $_)C= $_ eq $p[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | 3 | my ( $n, $rev ) = @p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | 3 | ▶ | return ( "fatal: tag '$n' already exists", 0 ) if $t->{$n} && !$force; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$$t{$n} and not $force
MC/DC0%0/2
$$t{$n} and not $force
$$t{$n}
not $force
Truth table33%1/3
A and not(B)
A= $$t{$n}B= not $force
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | 3 | ▶ | my $id = _rev( $r, $rev // 'HEAD' ) // return ( "fatal: Failed to resolve '$rev' as a valid ref.", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition75%3/4
_rev($r, $rev // "HEAD") // (return "fatal: Failed to resolve '${rev}' as a valid ref.", 0)
$rev // "HEAD"
MC/DC0%0/1
_rev($r, $rev // "HEAD") // (return "fatal: Failed to resolve '${rev}' as a valid ref.", 0)
_rev($r, $rev // "HEAD")
MC/DC100%1/1
$rev // "HEAD"
$rev
Truth table50%1/2
A
A= _rev($r, $rev // "HEAD")
Truth table100%2/2
A
A= $rev
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 0 | ▶ | if ( $ann && !defined $msg ) { push @GAPS, 'git tag -a (Editor)'; return ( "error: There was a problem with the editor 'editor'.", 0 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$ann and not defined $msg
MC/DC0%0/2
$ann and not defined $msg
$ann
not defined $msg
Truth table66%2/3
A and not(B)
A= $annB= not defined $msg
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | 3 | ▶ | $t->{$n} = { commit => $id, ( $ann ? ( annotated => JSON::MaybeXS::true(), message => $msg, tagger => _who( $dev, $r ) ) : () ) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | 3 | return ( '', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | # --- Server ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 23 | ▶ | sub _server { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_server: called CC=20 SCAR=37.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | 23 | my ( $ctx, $r, $remote ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | 23 | ▶ | my $rm = ( $r->{remotes} || {} )->{ $remote // 'origin' } or return ( undef, "fatal: '" . ( $remote // 'origin' ) . "' does not appear to be a git repository\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists." ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$$r{'remotes'} || {}
$remote // "origin"
$remote // "origin"
MC/DC0%0/1
$$r{'remotes'} || {}
$$r{'remotes'}
MC/DC100%1/1
$remote // "origin"
$remote
MC/DC0%0/1
$remote // "origin"
$remote
Truth table50%1/2
A
A= $$r{'remotes'}
Truth table100%2/2
A
A= $remote
Truth table0%0/2
A
A= $remote
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | 23 | ▶ | my $srv = ( $ctx->{state} || {} )->{ $rm->{host} // '' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$$ctx{'state'} || {}
$$rm{"host"} // ""
MC/DC0%0/1
$$ctx{'state'} || {}
$$ctx{'state'}
MC/DC0%0/1
$$rm{"host"} // ""
$$rm{"host"}
Truth table50%1/2
A
A= $$ctx{'state'}
Truth table50%1/2
A
A= $$rm{"host"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | 23 | ▶ | my ($h) = ( $rm->{url} // '' ) =~ m{\A(?:https?://|ssh://)?(?:[^@/]+@)?([^:/]+)}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$rm{"url"} // ""
MC/DC0%0/1
$$rm{"url"} // ""
$$rm{"url"}
Truth table50%1/2
A
A= $$rm{"url"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 23 | ▶ | $srv //= _by_hosts_file( $ctx, $h ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$srv //= _by_hosts_file($ctx, $h)
MC/DC50%1/2
$srv //= _by_hosts_file($ctx, $h)
$srv
_by_hosts_file($ctx, $h)
Truth table66%2/3
A //= B
A= $srvB= _by_hosts_file($ctx, $h)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | 23 | ▶ | return ( undef, "ssh: Could not resolve hostname " . ( $h // '' ) . ": Name or service not known\nfatal: Could not read from remote repository." ) unless $srv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$h // ""
MC/DC0%0/1
$h // ""
$h
Truth table50%1/2
A
A= $h
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | return ( undef, "ssh: connect to host $h port 22: Connection refused\nfatal: Could not read from remote repository." ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | 22 | ▶ | if ( $srv->{services} || {} )->{ $rm->{service} // 'forgejo' } && !$srv->{services}{ $rm->{service} // 'forgejo' }{active}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition44%4/9
($$srv{"services"} || {})->{$$rm{"service"} // "forgejo"} and not $$srv{"services"}{$$rm{"service"} // "forgejo"}{"active"}
$$srv{'services'} || {}
$$rm{"service"} // "forgejo"
$$rm{"service"} // "forgejo"
MC/DC0%0/2
($$srv{"services"} || {})->{$$rm{"service"} // "forgejo"} and not $$srv{"services"}{$$rm{"service"} // "forgejo"}{"active"}
$$srv{'services'}
not $$srv{"services"}{$$rm{"service"} // "forgejo"}{"active"}
MC/DC0%0/1
$$rm{"service"} // "forgejo"
$$rm{"service"}
MC/DC0%0/1
$$rm{"service"} // "forgejo"
$$rm{"service"}
Truth table33%1/3
A and not(B)
A= $$srv{'services'}B= not $$srv{"services"}{$$rm{"service"} // "forgejo"}{"active"}
Truth table50%1/2
A
A= $$rm{"service"}
Truth table50%1/2
A
A= $$rm{"service"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | 22 | ▶ | my $repo = ( ( $srv->{forgejo} || {} )->{repos} || {} )->{ $rm->{repo} // '' } or return ( undef, "fatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists." ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
($$srv{'forgejo'} || {})->{'repos'} || {}
$$srv{'forgejo'} || {}
$$rm{"repo"} // ""
MC/DC0%0/1
($$srv{'forgejo'} || {})->{'repos'} || {}
$$srv{'forgejo'}
MC/DC0%0/1
$$rm{"repo"} // ""
$$rm{"repo"}
Truth table50%1/2
A
A= $$srv{'forgejo'}
Truth table50%1/2
A
A= $$rm{"repo"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | 22 | return ( $repo, undef, $rm, $srv ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | # Name ueber /etc/hosts des aufrufenden Geraets -> Geraet mit dieser Adresse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | 1 | ▶ | sub _by_hosts_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_by_hosts_file: called CC=16 SCAR=44.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 1 | my ( $ctx, $name ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | 1 | ▶ | return undef unless defined $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | 1 | ▶ | my $st = $ctx->{state} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$ctx{'state'} || {}
MC/DC0%0/1
$$ctx{'state'} || {}
$$ctx{'state'}
Truth table50%1/2
A
A= $$ctx{'state'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | 1 | ▶ | my $me = $st->{ $ctx->{host} // '' } or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$ctx{"host"} // ""
MC/DC0%0/1
$$ctx{"host"} // ""
$$ctx{"host"}
Truth table50%1/2
A
A= $$ctx{"host"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | 1 | ▶ | my $hf = ( $me->{files} || {} )->{'/etc/hosts'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$me{'files'} || {}
MC/DC0%0/1
$$me{'files'} || {}
$$me{'files'}
Truth table50%1/2
A
A= $$me{'files'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | 1 | ▶ | $hf = $hf->{content} if ref $hf eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | 1 | ▶ | for my $l ( split /\n/, $hf // '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$hf // ""
MC/DC0%0/1
$hf // ""
$hf
Truth table50%1/2
A
A= $hf
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | 0 | my ( $ip, @names ) = split ' ', $l =~ s/#.*//r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | 0 | ▶ | next unless defined $ip && grep { $_ eq $name } @names; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $ip and grep {$_ eq $name;} @names
MC/DC0%0/2
defined $ip and grep {$_ eq $name;} @names
defined $ip
grep {$_ eq $name;} @names
Truth table0%0/3
A and B
A= defined $ipB= grep {$_ eq $name;} @names
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | 0 | for my $d ( sort keys %$st ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | 0 | ▶ | my $if = ( ref $st->{$d} eq 'HASH' ? $st->{$d}{interfaces} : undef ) || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
(ref $$st{$d} eq 'HASH' ? $$st{$d}{'interfaces'} : undef) || {}
MC/DC0%0/1
(ref $$st{$d} eq 'HASH' ? $$st{$d}{'interfaces'} : undef) || {}
(ref $$st{$d} eq 'HASH' ? $$st{$d}{'interfaces'} : undef)
Truth table0%0/2
A
A= (ref $$st{$d} eq 'HASH' ? $$st{$d}{'interfaces'} : undef)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | 0 | ▶ | return $st->{$d} if grep { ( $_ =~ s{/\d+\z}{}r ) eq $ip } map { @{ $_->{addr} || [] } } values %$if; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$$_{'addr'} || []
MC/DC0%0/1
$$_{'addr'} || []
$$_{'addr'}
Truth table0%0/2
A
A= $$_{'addr'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | 1 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | # Commits des Servers in das lokale Repo uebernehmen | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | 8 | ▶ | sub _import { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_import: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | 8 | my ( $r, $srepo, $ids ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | 8 | ▶ | for my $id (@$ids) { $r->{commits}{$id} //= _clone( $srepo->{commits}{$id} ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$$r{"commits"}{$id} //= _clone($$srepo{"commits"}{$id})
MC/DC0%0/2
$$r{"commits"}{$id} //= _clone($$srepo{"commits"}{$id})
$$r{"commits"}{$id}
_clone($$srepo{"commits"}{$id})
Truth table66%2/3
A //= B
A= $$r{"commits"}{$id}B= _clone($$srepo{"commits"}{$id})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | 8 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | 12 | ▶ | sub _g_fetch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_fetch: called CC=17 SCAR=34.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | 12 | my ( $dev, $root, $r, $a, $ctx ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | 0 | my ($remote) = grep { !/\A-/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | 12 | my ( $s, $err, $rm ) = _server( $ctx, $r, $remote ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | 12 | ▶ | return ( $err, 0 ) unless $s; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | 11 | my @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | 11 | ▶ | for my $b ( sort keys %{ $s->{refs}{heads} || {} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$s{'refs'}{'heads'} || {}
MC/DC0%0/1
$$s{'refs'}{'heads'} || {}
$$s{'refs'}{'heads'}
Truth table50%1/2
A
A= $$s{'refs'}{'heads'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | 11 | my $tip = $s->{refs}{heads}{$b}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | 11 | ▶ | my $old = ( $r->{refs}{remotes} || {} )->{ ( $remote // 'origin' ) . "/$b" }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$$r{'refs'}{'remotes'} || {}
$remote // "origin"
MC/DC0%0/1
$$r{'refs'}{'remotes'} || {}
$$r{'refs'}{'remotes'}
MC/DC0%0/1
$remote // "origin"
$remote
Truth table50%1/2
A
A= $$r{'refs'}{'remotes'}
Truth table50%1/2
A
A= $remote
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | 11 | ▶ | next if defined $old && $old eq $tip; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $old and $old eq $tip
MC/DC50%1/2
defined $old and $old eq $tip
defined $old
$old eq $tip
Truth table66%2/3
A and B
A= defined $oldB= $old eq $tip
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | 8 | _import( $r, $s, [ _range( $s, undef, $tip ) ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | 8 | ▶ | $r->{refs}{remotes}{ ( $remote // 'origin' ) . "/$b" } = $tip; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$remote // "origin"
MC/DC0%0/1
$remote // "origin"
$remote
Truth table50%1/2
A
A= $remote
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | 8 | ▶ | push @out, defined $old ? sprintf( ' %s..%s %-10s -> %s/%s', _short($old), _short($tip), $b, $remote // 'origin', $b ) : sprintf( ' * [new branch] %-10s -> %s/%s', $b, $remote // 'origin', $b ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition25%1/4
$remote // "origin"
$remote // "origin"
MC/DC0%0/1
$remote // "origin"
$remote
MC/DC0%0/1
$remote // "origin"
$remote
Truth table50%1/2
A
A= $remote
Truth table0%0/2
A
A= $remote
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | 11 | ▶ | for my $tg ( sort keys %{ $s->{refs}{tags} || {} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$s{'refs'}{'tags'} || {}
MC/DC0%0/1
$$s{'refs'}{'tags'} || {}
$$s{'refs'}{'tags'}
Truth table50%1/2
A
A= $$s{'refs'}{'tags'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | 0 | ▶ | next if ( $r->{refs}{tags} || {} )->{$tg}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$$r{'refs'}{'tags'} || {}
MC/DC0%0/1
$$r{'refs'}{'tags'} || {}
$$r{'refs'}{'tags'}
Truth table0%0/2
A
A= $$r{'refs'}{'tags'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | 0 | _import( $r, $s, [ _range( $s, undef, $s->{refs}{tags}{$tg}{commit} ) ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | 0 | $r->{refs}{tags}{$tg} = _clone( $s->{refs}{tags}{$tg} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | 0 | push @out, " * [new tag] $tg -> $tg"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | 11 | ▶ | return ( @out ? join( "\n", "From $rm->{url}", @out ) : '', 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | # Commits $ids (aelteste zuerst) auf $onto neu aufsetzen; Konflikt -> undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | 1 | ▶ | sub _replay { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_replay: called CC=14 SCAR=31.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | 1 | my ( $dev, $r, $ids, $onto ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | 1 | my $tip = $onto; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | 1 | for my $id (@$ids) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | 1 | my $c = $r->{commits}{$id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | 1 | ▶ | my $base = _tree( $r, ( $c->{parents} || [] )->[0] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$c{'parents'} || []
MC/DC0%0/1
$$c{'parents'} || []
$$c{'parents'}
Truth table50%1/2
A
A= $$c{'parents'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | 1 | my $tree = _clone( _tree( $r, $tip ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | 1 | for my $p ( keys %{ { %$base, %{ $c->{tree} } } } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | 4 | my ( $b, $n, $t ) = ( $base->{$p}, $c->{tree}{$p}, $tree->{$p} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | 4 | ▶ | next if ( $b // "\0" ) eq ( $n // "\0" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%2/4
$b // "\0"
$n // "\0"
MC/DC0%0/1
$b // "\0"
$b
MC/DC0%0/1
$n // "\0"
$n
Truth table50%1/2
A
A= $b
Truth table50%1/2
A
A= $n
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | 1 | ▶ | return ( undef, $p ) if ( $t // "\0" ) ne ( $b // "\0" ) && ( $t // "\0" ) ne ( $n // "\0" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition27%3/11
($t // "\0") ne ($b // "\0") and ($t // "\0") ne ($n // "\0")
$t // "\0"
$b // "\0"
$t // "\0"
$n // "\0"
MC/DC0%0/2
($t // "\0") ne ($b // "\0") and ($t // "\0") ne ($n // "\0")
$t
$t
MC/DC0%0/1
$b // "\0"
$b
MC/DC0%0/1
$n // "\0"
$n
Truth table0%0/3
A and B
A= $tB= $t
Truth table50%1/2
A
A= $b
Truth table0%0/2
A
A= $n
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | 0 | ▶ | if ( defined $n ) { $tree->{$p} = $n } else { delete $tree->{$p} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | 1 | $tip = _mk_commit( $dev, $r, parents => [$tip], message => $c->{message}, author => $c->{author}, date => $c->{date} + 1, tree => $tree ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | 1 | return ($tip); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | 0 | ▶ | sub _merge_trees { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_merge_trees: not called CC=12 SCAR=50.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | 0 | my ( $r, $base, $x, $y ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | 0 | my ( $bt, $xt, $yt ) = map { _tree( $r, $_ ) } $base, $x, $y; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | 0 | my %t = %$xt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | 0 | for my $p ( keys %{ { %$bt, %$xt, %$yt } } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | 0 | my ( $b, $m, $o ) = ( $bt->{$p}, $xt->{$p}, $yt->{$p} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | 0 | ▶ | next if ( $o // "\0" ) eq ( $b // "\0" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/4
$o // "\0"
$b // "\0"
MC/DC0%0/1
$o // "\0"
$o
MC/DC0%0/1
$b // "\0"
$b
Truth table0%0/2
A
A= $o
Truth table0%0/2
A
A= $b
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | 0 | ▶ | next if ( $m // "\0" ) eq ( $o // "\0" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/4
$m // "\0"
$o // "\0"
MC/DC0%0/1
$m // "\0"
$m
MC/DC0%0/1
$o // "\0"
$o
Truth table0%0/2
A
A= $m
Truth table0%0/2
A
A= $o
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | 0 | ▶ | return ( undef, $p ) if ( $m // "\0" ) ne ( $b // "\0" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/4
$m // "\0"
$b // "\0"
MC/DC0%0/1
$m // "\0"
$m
MC/DC0%0/1
$b // "\0"
$b
Truth table0%0/2
A
A= $m
Truth table0%0/2
A
A= $b
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | 0 | ▶ | if ( defined $o ) { $t{$p} = $o } else { delete $t{$p} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | 0 | return ( \%t ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | 2 | ▶ | sub _base { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_base: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | 2 | my ( $r, $x, $y ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | 2 | my $ax = _ancestors( $r, $x ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | 2 | my ($b) = grep { $ax->{$_} } map { $_ } reverse _range( $r, undef, $y ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | 2 | return $b; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | 7 | ▶ | sub _integrate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_integrate: called CC=20 SCAR=40.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | 7 | my ( $dev, $root, $r, $up, $how ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | 7 | my $h = _head($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | 7 | ▶ | my $name = $r->{branch} // 'HEAD'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{"branch"} // "HEAD"
MC/DC0%0/1
$$r{"branch"} // "HEAD"
$$r{"branch"}
Truth table50%1/2
A
A= $$r{"branch"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | 7 | ▶ | return ( 'Already up to date.', 1 ) if _ancestors( $r, $h )->{$up}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | 7 | ▶ | return ( "error: cannot pull with rebase: You have unstaged changes.\nerror: please commit or stash them.", 0 ) if $how eq 'rebase' && _dirty( $dev, $root, $r ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$how eq "rebase" and _dirty($dev, $root, $r)
MC/DC50%1/2
$how eq "rebase" and _dirty($dev, $root, $r)
$how eq "rebase"
_dirty($dev, $root, $r)
Truth table66%2/3
A and B
A= $how eq "rebase"B= _dirty($dev, $root, $r)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | 6 | ▶ | if ( !defined $h || _ancestors( $r, $up )->{$h} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not defined $h or _ancestors($r, $up)->{$h}
MC/DC50%1/2
not defined $h or _ancestors($r, $up)->{$h}
not defined $h
_ancestors($r, $up)->{$h}
Truth table66%2/3
not(A) or B
A= not defined $hB= _ancestors($r, $up)->{$h}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | 5 | ▶ | return ( 'error: Your local changes to the following files would be overwritten by merge.', 0 ) if _dirty( $dev, $root, $r ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | 5 | _switch_tree( $dev, $root, $r, $h, $up ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | 5 | ▶ | $r->{refs}{heads}{ $r->{branch} } = $up if defined $r->{branch}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | 5 | return ( 'Updating ' . _short($h) . '..' . _short($up) . "\nFast-forward", 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | 1 | ▶ | return ( "hint: Diverging branches can't be fast-forwarded, you need to either:\nhint:\nhint: \tgit merge --no-ff\nhint:\nhint: or:\nhint:\nhint: \tgit rebase\nhint:\nhint: Disable this message with \"git config advice.diverging false\"\nfatal: Not possible to fast-forward, aborting.", 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | if $how eq 'ff-only'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | 1 | my $base = _base( $r, $h, $up ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | 1 | ▶ | if ( $how eq 'rebase' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | 1 | my @mine = _range( $r, $base, $h ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | 1 | my ( $tip, $conf ) = _replay( $dev, $r, \@mine, $up ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | 1 | ▶ | return ( "CONFLICT (content): Merge conflict in $conf\nerror: could not apply " . _short( $mine[0] ) . "...\nhint: Resolve all conflicts manually, mark them as resolved with\nhint: \"git add/rm <conflicted_files>\", then run \"git rebase --continue\".", 0 ) unless $tip; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | 1 | _switch_tree( $dev, $root, $r, $h, $tip ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | 1 | ▶ | $r->{refs}{heads}{ $r->{branch} } = $tip if defined $r->{branch}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | 1 | ▶ | $r->{detached} = $tip unless defined $r->{branch}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | 1 | return ( "Successfully rebased and updated refs/heads/$name.", 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | 0 | ▶ | return ( "error: Your local changes to the following files would be overwritten by merge.", 0 ) if _dirty( $dev, $root, $r ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | 0 | my ( $tree, $conf ) = _merge_trees( $r, $base, $h, $up ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | 0 | ▶ | return ( "Auto-merging $conf\nCONFLICT (content): Merge conflict in $conf\nAutomatic merge failed; fix conflicts and then commit the result.", 0 ) unless $tree; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | 0 | ▶ | my $id = _mk_commit( $dev, $r, parents => [ $h, $up ], message => $how eq 'pull' ? "Merge branch '$name' of " . ( ( $r->{remotes}{origin} || {} )->{url} // 'origin' ) : "Merge remote-tracking branch '$how'", author => _who( $dev, $r ), tree => $tree ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/4
($$r{"remotes"}{"origin"} || {})->{"url"} // "origin"
$$r{'remotes'}{'origin'} || {}
MC/DC0%0/1
($$r{"remotes"}{"origin"} || {})->{"url"} // "origin"
$$r{'remotes'}{'origin'}
Truth table0%0/2
A
A= $$r{'remotes'}{'origin'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | 0 | _switch_tree( $dev, $root, $r, $h, $id ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | 0 | ▶ | $r->{refs}{heads}{ $r->{branch} } = $id if defined $r->{branch}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | 0 | return ( "Merge made by the 'ort' strategy.", 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | 8 | ▶ | sub _g_pull { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_pull: called CC=25 SCAR=40.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | 8 | my ( $dev, $root, $r, $a, $ctx ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | 0 | ▶ | my $how = ( grep { $_ eq '--rebase' || $_ eq '-r' } @$a ) ? 'rebase' : ( grep { $_ eq '--ff-only' } @$a ) ? 'ff-only' : ( grep { $_ eq '--no-rebase' || $_ eq '--no-ff' } @$a ) ? 'pull' : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition33%2/6
$_ eq '--rebase' || $_ eq '-r'
$_ eq '--no-rebase' || $_ eq '--no-ff'
MC/DC50%1/2
$_ eq '--rebase' || $_ eq '-r'
$_ eq '--rebase'
$_ eq '-r'
MC/DC0%0/2
$_ eq '--no-rebase' || $_ eq '--no-ff'
$_ eq '--no-rebase'
$_ eq '--no-ff'
Truth table66%2/3
A || B
A= $_ eq '--rebase'B= $_ eq '-r'
Truth table0%0/3
A || B
A= $_ eq '--no-rebase'B= $_ eq '--no-ff'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | 8 | ▶ | my %cfg = ( %{ ( $dev->{git} || {} )->{config} || {} }, %{ $r->{config} || {} } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
($$dev{'git'} || {})->{'config'} || {}
$$dev{'git'} || {}
$$r{'config'} || {}
MC/DC0%0/1
($$dev{'git'} || {})->{'config'} || {}
$$dev{'git'}
MC/DC100%1/1
$$r{'config'} || {}
$$r{'config'}
Truth table50%1/2
A
A= $$dev{'git'}
Truth table100%2/2
A
A= $$r{'config'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | 8 | ▶ | $how //= ( $cfg{'pull.rebase'} // '' ) =~ /\A(?:true|merges)\z/ ? 'rebase' : ( $cfg{'pull.ff'} // '' ) eq 'only' ? 'ff-only' : ( $cfg{'pull.rebase'} // '' ) eq 'false' ? 'pull' : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition62%5/8
$how //= ($cfg{"pull.rebase"} // "") =~ /\A(?:true|merges)\z/ ? "rebase" : (($cfg{"pull.ff"} // "") eq "only" ? "ff-only" : (($cfg{"pull.rebase"} // "") eq "false" ? "pull" : undef))
$cfg{"pull.rebase"} // ""
$cfg{"pull.ff"} // ""
$cfg{"pull.rebase"} // ""
MC/DC100%1/1
$how //= ($cfg{"pull.rebase"} // "") =~ /\A(?:true|merges)\z/ ? "rebase" : (($cfg{"pull.ff"} // "") eq "only" ? "ff-only" : (($cfg{"pull.rebase"} // "") eq "false" ? "pull" : undef))
$how
MC/DC0%0/1
$cfg{"pull.ff"} // ""
$cfg{"pull.ff"}
Truth table100%2/2
A
A= $how
Truth table50%1/2
A
A= $cfg{"pull.ff"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | 8 | my ( $fo, $fok ) = _g_fetch( $dev, $root, $r, [ grep { !/\A-/ } @$a ], $ctx ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | 8 | ▶ | return ( $fo, 0 ) unless $fok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | 8 | ▶ | my $up = ( $r->{refs}{remotes} || {} )->{ 'origin/' . ( $r->{branch} // '' ) } // return ( "There is no tracking information for the current branch.", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
($$r{"refs"}{"remotes"} || {})->{'origin/' . ($$r{"branch"} // "")} // (return "There is no tracking information for the current branch.", 0)
$$r{'refs'}{'remotes'} || {}
$$r{"branch"} // ""
MC/DC0%0/1
($$r{"refs"}{"remotes"} || {})->{'origin/' . ($$r{"branch"} // "")} // (return "There is no tracking information for the current branch.", 0)
$$r{'refs'}{'remotes'}
MC/DC0%0/1
$$r{"branch"} // ""
$$r{"branch"}
Truth table50%1/2
A
A= $$r{'refs'}{'remotes'}
Truth table50%1/2
A
A= $$r{"branch"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | 8 | my $h = _head($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | 8 | ▶ | if ( !defined $how ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | 2 | return ( join( "\n", grep {length} $fo, "hint: You have divergent branches and need to specify how to reconcile them.\nhint: You can do so by running one of the following commands sometime before\nhint: your next pull:\nhint:\nhint: git config pull.rebase false # merge\nhint: git config pull.rebase true # rebase\nhint: git config pull.ff only # fast-forward only\nhint:\nhint: You can replace \"git config\" with \"git config --global\" to set a default\nhint: preference for all repositories. You can also pass --rebase, --no-rebase,\nhint: or --ff-only on the command line to override the configured default per\nhint: invocation.\nfatal: Need to specify how to reconcile divergent branches." ), 0, 1 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | 1 | ▶ | if !_ancestors( $r, $up )->{$h} && !_ancestors( $r, $h )->{$up}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
_ancestors($r, $up)->{$h} or _ancestors($r, $h)->{$up}
MC/DC0%0/2
_ancestors($r, $up)->{$h} or _ancestors($r, $h)->{$up}
_ancestors($r, $up)->{$h}
_ancestors($r, $h)->{$up}
Truth table33%1/3
A or B
A= _ancestors($r, $up)->{$h}B= _ancestors($r, $h)->{$up}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | 0 | $how = 'pull'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | 0 | my ( $o, $ok ) = $how eq 'rebase' || grep( { $_ eq '--autostash' } @$a ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | 7 | ▶ | ? _autostash( $dev, $root, $r, $a, sub { _integrate( $dev, $root, $r, $up, $how ) } ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | 7 | ▶ | : _integrate( $dev, $root, $r, $up, $how ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$how eq "rebase" or grep {$_ eq "--autostash";} @$a
MC/DC0%0/2
$how eq "rebase" or grep {$_ eq "--autostash";} @$a
$how eq "rebase"
grep {$_ eq "--autostash";} @$a
Truth table33%1/3
A or B
A= $how eq "rebase"B= grep {$_ eq "--autostash";} @$a
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | 7 | return ( join( "\n", grep {length} $fo, $o ), $ok, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | 0 | ▶ | sub _g_rebase { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_rebase: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | 0 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | 0 | ▶ | if ( grep { /\A(?:-i|--interactive)\z/ } @$a ) { push @GAPS, 'git rebase -i'; return ( 'error: There was a problem with the editor \'editor\'.', 0 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | 0 | ▶ | return ( 'fatal: No rebase in progress?', 0 ) if grep { /\A--(?:abort|continue|skip)\z/ } @$a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | 0 | my ($onto) = grep { !/\A-/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | 0 | ▶ | $onto //= 'origin/' . ( $r->{branch} // '' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$onto //= 'origin/' . ($$r{"branch"} // "")
$$r{"branch"} // ""
MC/DC0%0/1
$onto //= 'origin/' . ($$r{"branch"} // "")
$onto
MC/DC0%0/1
$$r{"branch"} // ""
$$r{"branch"}
Truth table0%0/2
A
A= $onto
Truth table0%0/2
A
A= $$r{"branch"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | 0 | ▶ | my $up = _rev( $r, $onto ) // return ( "fatal: invalid upstream '$onto'", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
_rev($r, $onto) // (return "fatal: invalid upstream '${onto}'", 0)
MC/DC0%0/1
_rev($r, $onto) // (return "fatal: invalid upstream '${onto}'", 0)
_rev($r, $onto)
Truth table0%0/2
A
A= _rev($r, $onto)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | 0 | ▶ | return ( 'Current branch ' . ( $r->{branch} // 'HEAD' ) . ' is up to date.', 1 ) if _ancestors( $r, _head($r) )->{$up}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$$r{"branch"} // "HEAD"
MC/DC0%0/1
$$r{"branch"} // "HEAD"
$$r{"branch"}
Truth table0%0/2
A
A= $$r{"branch"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | 0 | ▶ | return _autostash( $dev, $root, $r, $a, sub { _integrate( $dev, $root, $r, $up, 'rebase' ) } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | 0 | ▶ | sub _g_merge { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_merge: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | 0 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | 0 | my ($what) = grep { !/\A-/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | 0 | ▶ | return ( 'fatal: No remote for the current branch.', 0 ) unless defined $what; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | 0 | ▶ | my $up = _rev( $r, $what ) // return ( "merge: $what - not something we can merge", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
_rev($r, $what) // (return "merge: $what - not something we can merge", 0)
MC/DC0%0/1
_rev($r, $what) // (return "merge: $what - not something we can merge", 0)
_rev($r, $what)
Truth table0%0/2
A
A= _rev($r, $what)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | 0 | ▶ | return _integrate( $dev, $root, $r, $up, ( grep { $_ eq '--ff-only' } @$a ) ? 'ff-only' : $what ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | 1 | ▶ | sub _g_cherry_pick { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_cherry_pick: called CC=33 SCAR=46.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | 1 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | 1 | my $x = grep { $_ eq '-x' } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | 1 | ▶ | my $nocommit = grep { $_ eq '-n' || $_ eq '--no-commit' } @$a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$_ eq '-n' || $_ eq '--no-commit'
MC/DC0%0/2
$_ eq '-n' || $_ eq '--no-commit'
$_ eq '-n'
$_ eq '--no-commit'
Truth table33%1/3
A || B
A= $_ eq '-n'B= $_ eq '--no-commit'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | 1 | ▶ | return ( 'error: no cherry-pick or revert in progress', 0 ) if grep { /\A--(?:abort|continue|skip|quit)\z/ } @$a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | 0 | ▶ | if ( grep { $_ eq '-e' || $_ eq '--edit' } @$a ) { push @GAPS, 'git cherry-pick --edit'; return ( "error: There was a problem with the editor 'editor'.", 0 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_ eq '-e' || $_ eq '--edit'
MC/DC0%0/2
$_ eq '-e' || $_ eq '--edit'
$_ eq '-e'
$_ eq '--edit'
Truth table33%1/3
A || B
A= $_ eq '-e'B= $_ eq '--edit'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | 1 | my @specs = grep { !/\A-/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | 1 | ▶ | return ( 'usage: git cherry-pick [--edit] [-n] [-m <parent-number>] [-s] [-x] [--ff] <commit>...', 0 ) unless @specs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | 1 | ▶ | return ( "error: your local changes would be overwritten by cherry-pick.\nhint: commit your changes or stash them to proceed.\nfatal: cherry-pick failed", 0 ) if _dirty( $dev, $root, $r ) && !$nocommit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
_dirty($dev, $root, $r) and not $nocommit
MC/DC0%0/2
_dirty($dev, $root, $r) and not $nocommit
_dirty($dev, $root, $r)
not $nocommit
Truth table33%1/3
A and not(B)
A= _dirty($dev, $root, $r)B= not $nocommit
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | 1 | my @ids; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | 1 | for my $sp (@specs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | 1 | ▶ | if ( $sp =~ /\A(.+?)\.\.(.+)\z/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | 0 | my ( $f, $t ) = ( _rev( $r, $1 ), _rev( $r, $2 ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | 0 | ▶ | return ( "fatal: bad revision '$sp'", 0 ) unless defined $f && defined $t; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $f and defined $t
MC/DC0%0/2
defined $f and defined $t
defined $f
defined $t
Truth table0%0/3
A and B
A= defined $fB= defined $t
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | 0 | push @ids, _range( $r, $f, $t ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | 1 | ▶ | push @ids, _rev( $r, $sp ) // return ( "fatal: bad revision '$sp'", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
_rev($r, $sp) // (return "fatal: bad revision '${sp}'", 0)
MC/DC0%0/1
_rev($r, $sp) // (return "fatal: bad revision '${sp}'", 0)
_rev($r, $sp)
Truth table50%1/2
A
A= _rev($r, $sp)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | 1 | my $h = _head($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | 1 | my $tip = $h; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | 1 | my @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | 1 | for my $id (@ids) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | 1 | my $c = $r->{commits}{$id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | 1 | ▶ | return ( "error: commit $id is a merge but no -m option was given.\nfatal: cherry-pick failed", 0 ) if @{ $c->{parents} || [] } > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$c{'parents'} || []
MC/DC0%0/1
$$c{'parents'} || []
$$c{'parents'}
Truth table50%1/2
A
A= $$c{'parents'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | 1 | ▶ | my $base = _tree( $r, ( $c->{parents} || [] )->[0] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$c{'parents'} || []
MC/DC0%0/1
$$c{'parents'} || []
$$c{'parents'}
Truth table50%1/2
A
A= $$c{'parents'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | 1 | my $tree = _clone( _tree( $r, $tip ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | 1 | for my $p ( keys %{ { %$base, %{ $c->{tree} } } } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | 5 | my ( $b, $n ) = ( $base->{$p}, $c->{tree}{$p} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | 5 | ▶ | next if ( $b // "\0" ) eq ( $n // "\0" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition75%3/4
$b // "\0"
$n // "\0"
MC/DC100%1/1
$b // "\0"
$b
MC/DC0%0/1
$n // "\0"
$n
Truth table100%2/2
A
A= $b
Truth table50%1/2
A
A= $n
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | return ( "error: could not apply " . _short($id) . '... ' . _subject( $c->{message} ) . "\nhint: After resolving the conflicts, mark them with\nhint: \"git add/rm <pathspec>\", then run\nhint: \"git cherry-pick --continue\".\nCONFLICT (content): Merge conflict in $p", 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | 1 | ▶ | if ( $tree->{$p} // "\0" ) ne ( $b // "\0" ) && ( $tree->{$p} // "\0" ) ne ( $n // "\0" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition27%3/11
($$tree{$p} // "\0") ne ($b // "\0") and ($$tree{$p} // "\0") ne ($n // "\0")
$$tree{$p} // "\0"
$b // "\0"
$$tree{$p} // "\0"
$n // "\0"
MC/DC0%0/2
($$tree{$p} // "\0") ne ($b // "\0") and ($$tree{$p} // "\0") ne ($n // "\0")
$$tree{$p}
$$tree{$p}
MC/DC0%0/1
$b // "\0"
$b
MC/DC0%0/1
$n // "\0"
$n
Truth table33%1/3
A and B
A= $$tree{$p}B= $$tree{$p}
Truth table50%1/2
A
A= $b
Truth table0%0/2
A
A= $n
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | 0 | ▶ | if ( defined $n ) { $tree->{$p} = $n } else { delete $tree->{$p} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | 0 | ▶ | if ($nocommit) { $r->{index} = $tree; next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | 1 | ▶ | my $msg = $c->{message} . ( $x ? "\n\n(cherry picked from commit $id)" : '' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | 1 | $tip = _mk_commit( $dev, $r, parents => [ grep {defined} $tip ], message => $msg, author => $c->{author}, tree => $tree ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | 1 | ▶ | push @out, '[' . ( $r->{branch} // 'detached HEAD' ) . ' ' . _short($tip) . '] ' . _subject($msg); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{"branch"} // "detached HEAD"
MC/DC0%0/1
$$r{"branch"} // "detached HEAD"
$$r{"branch"}
Truth table50%1/2
A
A= $$r{"branch"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | 0 | ▶ | if ($nocommit) { _set_work( $dev, $root, _work_tracked( $dev, $root, $r ), $r->{index} ); return ( '', 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | 1 | _switch_tree( $dev, $root, $r, $h, $tip ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | 0 | ▶ | if ( defined $r->{branch} ) { $r->{refs}{heads}{ $r->{branch} } = $tip } else { $r->{detached} = $tip } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | 1 | return ( join( "\n", @out ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | 2 | ▶ | sub _g_revert { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_revert: called CC=26 SCAR=36.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | 2 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | 2 | my $noedit = grep { $_ eq '--no-edit' } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | 2 | ▶ | my $nocommit = grep { $_ eq '-n' || $_ eq '--no-commit' } @$a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$_ eq '-n' || $_ eq '--no-commit'
MC/DC0%0/2
$_ eq '-n' || $_ eq '--no-commit'
$_ eq '-n'
$_ eq '--no-commit'
Truth table33%1/3
A || B
A= $_ eq '-n'B= $_ eq '--no-commit'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | 2 | my @revs = grep { !/\A-/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | 2 | ▶ | return ( 'usage: git revert [--[no-]edit] [-n] [-m <parent-number>] [-s] [-S[<keyid>]] <commit>...', 0 ) unless @revs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | 2 | ▶ | if ( !$noedit && !$nocommit ) { push @GAPS, 'git revert (Editor)'; return ( "error: There was a problem with the editor 'editor'.\nPlease supply the message using either -m or -F option.", 0 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$noedit or $nocommit
MC/DC50%1/2
$noedit or $nocommit
$noedit
$nocommit
Truth table66%2/3
A or B
A= $noeditB= $nocommit
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | 1 | ▶ | return ( "error: your local changes would be overwritten by revert.\nhint: commit your changes or stash them to proceed.\nfatal: revert failed", 0 ) if _dirty( $dev, $root, $r ) && !$nocommit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
_dirty($dev, $root, $r) and not $nocommit
MC/DC0%0/2
_dirty($dev, $root, $r) and not $nocommit
_dirty($dev, $root, $r)
not $nocommit
Truth table33%1/3
A and not(B)
A= _dirty($dev, $root, $r)B= not $nocommit
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | 1 | my @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | 1 | for my $spec (@revs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | 1 | ▶ | my $id = _rev( $r, $spec ) // return ( "fatal: bad revision '$spec'", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
_rev($r, $spec) // (return "fatal: bad revision '${spec}'", 0)
MC/DC0%0/1
_rev($r, $spec) // (return "fatal: bad revision '${spec}'", 0)
_rev($r, $spec)
Truth table50%1/2
A
A= _rev($r, $spec)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | 1 | my $c = $r->{commits}{$id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | 1 | ▶ | return ( "error: commit $id is a merge but no -m option was given.\nfatal: revert failed", 0 ) if @{ $c->{parents} || [] } > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$c{'parents'} || []
MC/DC0%0/1
$$c{'parents'} || []
$$c{'parents'}
Truth table50%1/2
A
A= $$c{'parents'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | 1 | ▶ | my $base = _tree( $r, ( $c->{parents} || [] )->[0] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$c{'parents'} || []
MC/DC0%0/1
$$c{'parents'} || []
$$c{'parents'}
Truth table50%1/2
A
A= $$c{'parents'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | 1 | ▶ | my $tree = _clone( $nocommit ? _index($r) : _tree( $r, _head($r) ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | 1 | for my $p ( keys %{ { %$base, %{ $c->{tree} } } } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | 5 | my ( $old, $new ) = ( $base->{$p}, $c->{tree}{$p} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | 5 | ▶ | next if ( $old // "\0" ) eq ( $new // "\0" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition75%3/4
$old // "\0"
$new // "\0"
MC/DC100%1/1
$old // "\0"
$old
MC/DC0%0/1
$new // "\0"
$new
Truth table100%2/2
A
A= $old
Truth table50%1/2
A
A= $new
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | return ( "error: could not revert " . _short($id) . '... ' . _subject( $c->{message} ) . "\nhint: after resolving the conflicts, mark the corrected paths\nhint: with 'git add <paths>' or 'git rm <paths>'\nCONFLICT (content): Merge conflict in $p", 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | 1 | ▶ | if ( $tree->{$p} // "\0" ) ne ( $new // "\0" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%2/4
$$tree{$p} // "\0"
$new // "\0"
MC/DC0%0/1
$$tree{$p} // "\0"
$$tree{$p}
MC/DC0%0/1
$new // "\0"
$new
Truth table50%1/2
A
A= $$tree{$p}
Truth table50%1/2
A
A= $new
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | 0 | ▶ | if ( defined $old ) { $tree->{$p} = $old } else { delete $tree->{$p} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | 1 | my $w = _work( $dev, $root ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | 1 | ▶ | _set_work( $dev, $root, { map { $_ => 1 } grep { exists $base->{$_} || exists $c->{tree}{$_} } keys %$w }, { map { exists $tree->{$_} ? ( $_ => $tree->{$_} ) : () } keys %{ { %$base, %{ $c->{tree} } } } } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $$base{$_} || exists $$c{'tree'}{$_}
MC/DC0%0/2
exists $$base{$_} || exists $$c{'tree'}{$_}
exists $$base{$_}
exists $$c{'tree'}{$_}
Truth table66%2/3
A || B
A= exists $$base{$_}B= exists $$c{'tree'}{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | 0 | ▶ | if ($nocommit) { $r->{index} = $tree; next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | 1 | my $h = _head($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | 1 | my $nid = _mk_commit( $dev, $r, parents => [$h], message => 'Revert "' . _subject( $c->{message} ) . "\"\n\nThis reverts commit $id.", author => _who( $dev, $r ), tree => $tree ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | 0 | ▶ | if ( defined $r->{branch} ) { $r->{refs}{heads}{ $r->{branch} } = $nid } else { $r->{detached} = $nid } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | 1 | delete $r->{index}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | 1 | ▶ | push @out, '[' . ( $r->{branch} // 'detached HEAD' ) . ' ' . _short($nid) . '] Revert "' . _subject( $c->{message} ) . '"'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{"branch"} // "detached HEAD"
MC/DC0%0/1
$$r{"branch"} // "detached HEAD"
$$r{"branch"}
Truth table50%1/2
A
A= $$r{"branch"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | 1 | return ( join( "\n", @out ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | # stash: Eintraege (neuester zuerst) mit Basis-Commit, verfolgtem Arbeitsbaum und | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | # (mit -u) unverfolgten Dateien; der Index wird nicht eigens gesichert. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | 6 | ▶ | sub _stash_save { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_stash_save: called CC=26 SCAR=34.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | 6 | my ( $dev, $root, $r, $msg, $untracked, $only ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | 6 | my $h = _head($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | 6 | my $base = _tree( $r, $h ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | 6 | my $w = _work( $dev, $root ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | 6 | my $idx = _index($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | # mit Pfaden (stash push -- PFAD): nur diese beiseite, alles andere bleibt, wie es ist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | 6 | ▶ | my $sel = sub { my ($p) = @_; return 1 unless $only; return scalar grep { $_ eq '' || $p eq $_ || index( $p, "$_/" ) == 0 } @$only }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.0
Branch: 1 branch
Condition66%4/6
$_ eq '' || $p eq $_ || index($p, "$_/") == 0
$_ eq "" or $p eq $_
MC/DC33%1/3
$_ eq '' || $p eq $_ || index($p, "$_/") == 0
$_ eq ""
$p eq $_
index($p, "$_/") == 0
Truth table50%2/4
A or B || C
A= $_ eq ""B= $p eq $_C= index($p, "$_/") == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | 6 | my %track = map { $_ => 1 } grep { $sel->($_) } keys %{ { %$base, %$idx } }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | 6 | ▶ | my %saved = map { exists $w->{$_} ? ( $_ => $w->{$_} ) : () } keys %track; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | 6 | ▶ | $saved{$_} //= $idx->{$_} for grep { !exists $base->{$_} && $track{$_} } keys %$idx; # neu im Index | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition16%1/6
!exists($$base{$_}) && $track{$_}
$saved{$_} //= $$idx{$_}
MC/DC0%0/2
!exists($$base{$_}) && $track{$_}
!exists($$base{$_})
$track{$_}
MC/DC0%0/2
$saved{$_} //= $$idx{$_}
$saved{$_}
$$idx{$_}
Truth table33%1/3
not(A) && B
A= !exists($$base{$_})B= $track{$_}
Truth table0%0/3
A //= B
A= $saved{$_}B= $$idx{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | 6 | my @ig = _ignore_res($w); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | 6 | ▶ | my %un = $untracked ? map { ( $_ => $w->{$_} ) } grep { !$track{$_} && $sel->($_) && !_ignored( \@ig, $_ ) } keys %$w : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
!$track{$_} && &$sel($_) && !_ignored(\@ig, $_)
not $track{$_} and &$sel($_)
MC/DC33%1/3
!$track{$_} && &$sel($_) && !_ignored(\@ig, $_)
not $track{$_}
&$sel($_)
!_ignored(\@ig, $_)
Truth table50%2/4
not(A) and B && not(C)
A= not $track{$_}B= &$sel($_)C= !_ignored(\@ig, $_)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | 6 | ▶ | my $changed = grep { ( $saved{$_} // "\0" ) ne ( $base->{$_} // "\0" ) } keys %{ { %saved, %$base } }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition75%3/4
$saved{$_} // "\0"
$$base{$_} // "\0"
MC/DC100%1/1
$saved{$_} // "\0"
$saved{$_}
MC/DC0%0/1
$$base{$_} // "\0"
$$base{$_}
Truth table100%2/2
A
A= $saved{$_}
Truth table50%1/2
A
A= $$base{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | 6 | ▶ | return undef unless $changed || %un; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$changed or %un
MC/DC100%2/2
$changed or %un
$changed
%un
Truth table100%3/3
A or B
A= $changedB= %un
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | my $label = defined $msg ? 'On ' . ( $r->{branch} // '(no branch)' ) . ": $msg" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | 5 | ▶ | : 'WIP on ' . ( $r->{branch} // '(no branch)' ) . ': ' . _short($h) . ' ' . _subject( ( $r->{commits}{$h} || {} )->{message} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$$r{"branch"} // "(no branch)"
$$r{"branch"} // "(no branch)"
$$r{'commits'}{$h} || {}
MC/DC0%0/1
$$r{"branch"} // "(no branch)"
$$r{"branch"}
MC/DC0%0/1
$$r{"branch"} // "(no branch)"
$$r{"branch"}
MC/DC0%0/1
$$r{'commits'}{$h} || {}
$$r{'commits'}{$h}
Truth table50%1/2
A
A= $$r{"branch"}
Truth table50%1/2
A
A= $$r{"branch"}
Truth table50%1/2
A
A= $$r{'commits'}{$h}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | 5 | ▶ | $saved{$_} //= $base->{$_} for grep { !$track{$_} } keys %$base; # nicht gewaehlt: unveraendert | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$saved{$_} //= $$base{$_}
MC/DC0%0/2
$saved{$_} //= $$base{$_}
$saved{$_}
$$base{$_}
Truth table33%1/3
A //= B
A= $saved{$_}B= $$base{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | 5 | my $e = { base => $h, work => \%saved, untracked => \%un, message => $label }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | 5 | $e->{id} = Digest::SHA::sha1_hex( $J->encode($e) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | 5 | unshift @{ $r->{stash} }, $e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | 5 | ▶ | _set_work( $dev, $root, { map { $_ => 1 } grep { $track{$_} || exists $un{$_} } keys %$w }, { map { exists $base->{$_} ? ( $_ => $base->{$_} ) : () } keys %track } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$track{$_} || exists $un{$_}
MC/DC100%2/2
$track{$_} || exists $un{$_}
$track{$_}
exists $un{$_}
Truth table100%3/3
A || B
A= $track{$_}B= exists $un{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | 5 | ▶ | if ($only) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | 1 | $idx->{$_} = $base->{$_} for grep { exists $base->{$_} } keys %track; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | 1 | delete $idx->{$_} for grep { !exists $base->{$_} } keys %track; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | 1 | $r->{index} = $idx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1398 | 1 | ▶ | delete $r->{index} unless grep { ( $idx->{$_} // "\0" ) ne ( $base->{$_} // "\0" ) } keys %{ { %$idx, %$base } }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%2/4
$$idx{$_} // "\0"
$$base{$_} // "\0"
MC/DC0%0/1
$$idx{$_} // "\0"
$$idx{$_}
MC/DC0%0/1
$$base{$_} // "\0"
$$base{$_}
Truth table50%1/2
A
A= $$idx{$_}
Truth table50%1/2
A
A= $$base{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | 4 | else { delete $r->{index} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | 5 | return $e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | 5 | ▶ | sub _stash_apply { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_stash_apply: called CC=20 SCAR=35.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | 5 | my ( $dev, $root, $r, $e ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | 5 | my $base = _tree( $r, $e->{base} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | 5 | my $head = _tree( $r, _head($r) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | 5 | my $w = _work( $dev, $root ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | 5 | my ( $st, $un ) = _changes( $dev, $root, $r ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | 0 | my %dirty = map { $_->[1] => 1 } @$st, @$un; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | 5 | my %new = %$w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | 5 | for my $p ( sort keys %{ { %$base, %{ $e->{work} } } } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | 20 | my ( $old, $mine ) = ( $base->{$p}, $e->{work}{$p} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | 20 | ▶ | next if ( $old // "\0" ) eq ( $mine // "\0" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%2/4
$old // "\0"
$mine // "\0"
MC/DC0%0/1
$old // "\0"
$old
MC/DC0%0/1
$mine // "\0"
$mine
Truth table50%1/2
A
A= $old
Truth table50%1/2
A
A= $mine
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | 4 | ▶ | return ( "error: Your local changes to the following files would be overwritten by merge:\n\t$p\nPlease commit your changes or stash them before you merge.\nAborting", 0 ) if $dirty{$p}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | 4 | my $cur = $head->{$p}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | 4 | ▶ | if ( ( $cur // "\0" ) ne ( $old // "\0" ) && ( $cur // "\0" ) ne ( $mine // "\0" ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition27%3/11
($cur // "\0") ne ($old // "\0") and ($cur // "\0") ne ($mine // "\0")
$cur // "\0"
$old // "\0"
$cur // "\0"
$mine // "\0"
MC/DC0%0/2
($cur // "\0") ne ($old // "\0") and ($cur // "\0") ne ($mine // "\0")
$cur
$cur
MC/DC0%0/1
$old // "\0"
$old
MC/DC0%0/1
$mine // "\0"
$mine
Truth table0%0/3
A and B
A= $curB= $cur
Truth table50%1/2
A
A= $old
Truth table0%0/2
A
A= $mine
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1418 | 0 | return ( "Auto-merging $p\nCONFLICT (content): Merge conflict in $p\nThe stash entry is kept in case you need it again.", 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1419 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1420 | 0 | ▶ | if ( defined $mine ) { $new{$p} = $mine } else { delete $new{$p} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1421 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1422 | 5 | for my $p ( keys %{ $e->{untracked} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1423 | 1 | ▶ | return ( "$p already exists, no checkout\nerror: could not restore untracked files from stash", 0 ) if exists $w->{$p}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1424 | 1 | $new{$p} = $e->{untracked}{$p}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1425 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1426 | 5 | _set_work( $dev, $root, $w, \%new ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1427 | 5 | my $idx = _index($r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1428 | 5 | ▶ | $idx->{$_} = $e->{work}{$_} for grep { !exists $base->{$_} && defined $e->{work}{$_} } keys %{ $e->{work} }; # neue Dateien wieder im Index | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
!exists($$base{$_}) && defined $$e{'work'}{$_}
MC/DC0%0/2
!exists($$base{$_}) && defined $$e{'work'}{$_}
!exists($$base{$_})
defined $$e{'work'}{$_}
Truth table33%1/3
not(A) && B
A= !exists($$base{$_})B= defined $$e{'work'}{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1429 | 5 | $r->{index} = $idx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1430 | 5 | ▶ | delete $r->{index} unless grep { ( $idx->{$_} // "\0" ) ne ( $head->{$_} // "\0" ) } keys %{ { %$idx, %$head } }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%2/4
$$idx{$_} // "\0"
$$head{$_} // "\0"
MC/DC0%0/1
$$idx{$_} // "\0"
$$idx{$_}
MC/DC0%0/1
$$head{$_} // "\0"
$$head{$_}
Truth table50%1/2
A
A= $$idx{$_}
Truth table50%1/2
A
A= $$head{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1431 | 5 | return ( '', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1433 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1434 | 5 | ▶ | sub _stash_ref { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_stash_ref: called CC=5 SCAR=23.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1435 | 5 | my ( $r, $spec ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1436 | 5 | ▶ | my $n = !defined $spec ? 0 : $spec =~ /\A(?:stash\@\{(\d+)\}|(\d+))\z/ ? $1 // $2 : return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$1 // $2
MC/DC0%0/2
$1 // $2
$1
$2
Truth table0%0/3
A // B
A= $1B= $2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1437 | 5 | ▶ | return ( $n, ( $r->{stash} || [] )->[$n] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{'stash'} || []
MC/DC0%0/1
$$r{'stash'} || []
$$r{'stash'}
Truth table50%1/2
A
A= $$r{'stash'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1438 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1439 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1440 | 10 | ▶ | sub _g_stash { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_stash: called CC=35 SCAR=39.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1441 | 10 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1442 | 10 | my @x = @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1443 | 10 | ▶ | my $sub = @x && $x[0] !~ /\A-/ ? shift @x : 'push'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@x and not $x[0] =~ /\A-/
MC/DC100%2/2
@x and not $x[0] =~ /\A-/
@x
not $x[0] =~ /\A-/
Truth table100%3/3
A and not(B)
A= @xB= not $x[0] =~ /\A-/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1444 | 10 | my @p = grep { !/\A-/ } @x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1445 | 10 | ▶ | if ( $sub eq 'push' || $sub eq 'save' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$sub eq "push" or $sub eq "save"
MC/DC50%1/2
$sub eq "push" or $sub eq "save"
$sub eq "push"
$sub eq "save"
Truth table66%2/3
A or B
A= $sub eq "push"B= $sub eq "save"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1446 | 4 | my $msg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1447 | 4 | ▶ | for my $i ( 0 .. $#x ) { $msg = $x[ $i + 1 ] if $x[$i] eq '-m' || $x[$i] eq '--message' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$x[$i] eq "-m" or $x[$i] eq "--message"
MC/DC50%1/2
$x[$i] eq "-m" or $x[$i] eq "--message"
$x[$i] eq "-m"
$x[$i] eq "--message"
Truth table66%2/3
A or B
A= $x[$i] eq "-m"B= $x[$i] eq "--message"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1448 | 4 | ▶ | $msg //= join ' ', @p if $sub eq 'save' && @p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
$sub eq "save" and @p
$msg //= join(" ", @p)
MC/DC0%0/2
$sub eq "save" and @p
$sub eq "save"
@p
MC/DC0%0/1
$msg //= join(" ", @p)
$msg
Truth table33%1/3
A and B
A= $sub eq "save"B= @p
Truth table0%0/2
A
A= $msg
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1449 | 4 | ▶ | my @spec = $sub eq 'push' ? grep { !defined $msg || $_ ne $msg } @p : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
!defined($msg) || $_ ne $msg
MC/DC50%1/2
!defined($msg) || $_ ne $msg
!defined($msg)
$_ ne $msg
Truth table66%2/3
not(A) || B
A= !defined($msg)B= $_ ne $msg
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1450 | 4 | ▶ | my $only = @spec ? [ grep {defined} _paths( $root, $CWD, @spec ) ] : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1451 | 4 | ▶ | my $u = grep { $_ eq '-u' || $_ eq '--include-untracked' || $_ eq '-a' || $_ eq '--all' } @x; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%6/9
$_ eq '-u' || $_ eq '--include-untracked' || $_ eq '-a' || $_ eq '--all'
$_ eq "-u" or $_ eq "--include-untracked" or $_ eq "-a"
$_ eq "-u" or $_ eq "--include-untracked"
MC/DC25%1/4
$_ eq '-u' || $_ eq '--include-untracked' || $_ eq '-a' || $_ eq '--all'
$_ eq "-u"
$_ eq "--include-untracked"
$_ eq "-a"
$_ eq '--all'
Truth table40%2/5
A or B or C || D
A= $_ eq "-u"B= $_ eq "--include-untracked"C= $_ eq "-a"D= $_ eq '--all'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1452 | 4 | ▶ | my $e = _stash_save( $dev, $root, $r, $msg, $u, $only ) // return ( 'No local changes to save', 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
_stash_save($dev, $root, $r, $msg, $u, $only) // (return "No local changes to save", 1)
MC/DC100%1/1
_stash_save($dev, $root, $r, $msg, $u, $only) // (return "No local changes to save", 1)
_stash_save($dev, $root, $r, $msg, $u, $only)
Truth table100%2/2
A
A= _stash_save($dev, $root, $r, $msg, $u, $only)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1453 | 3 | return ( "Saved working directory and index state $e->{message}", 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1454 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1455 | 6 | ▶ | if ( $sub eq 'list' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1456 | 1 | ▶ | my $l = $r->{stash} || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{'stash'} || []
MC/DC0%0/1
$$r{'stash'} || []
$$r{'stash'}
Truth table50%1/2
A
A= $$r{'stash'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1457 | 1 | return ( join( "\n", map {"stash\@{$_}: $l->[$_]{message}"} 0 .. $#$l ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1458 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1459 | 0 | ▶ | if ( $sub eq 'clear' ) { delete $r->{stash}; return ( '', 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1460 | 5 | my ( $n, $e ) = _stash_ref( $r, $p[0] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1461 | 5 | ▶ | return ( defined $p[0] ? "error: $p[0] is not a valid reference" : 'No stash entries found.', 0 ) unless $e; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1462 | 5 | ▶ | if ( $sub eq 'show' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1463 | 0 | ▶ | my $mode = ( grep { $_ eq '-p' || $_ eq '--patch' } @x ) ? undef : ( grep { $_ eq '--name-only' } @x ) ? 'name-only' : 'stat'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$_ eq '-p' || $_ eq '--patch'
MC/DC0%0/2
$_ eq '-p' || $_ eq '--patch'
$_ eq '-p'
$_ eq '--patch'
Truth table33%1/3
A || B
A= $_ eq '-p'B= $_ eq '--patch'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1464 | 1 | my $base = _tree( $r, $e->{base} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1465 | 1 | return ( _diff_trees( $base, { %$base, %{ $e->{work} } }, $mode ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1466 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1467 | 4 | ▶ | if ( $sub eq 'apply' || $sub eq 'pop' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$sub eq "apply" or $sub eq "pop"
MC/DC100%2/2
$sub eq "apply" or $sub eq "pop"
$sub eq "apply"
$sub eq "pop"
Truth table100%3/3
A or B
A= $sub eq "apply"B= $sub eq "pop"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1468 | 3 | my ( $o, $ok ) = _stash_apply( $dev, $root, $r, $e ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1469 | 3 | ▶ | return ( $o, 0 ) unless $ok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1470 | 3 | ▶ | splice @{ $r->{stash} }, $n, 1 if $sub eq 'pop'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1471 | 3 | my ( $st, $un, $ut ) = _changes( $dev, $root, $r ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1472 | 2 | ▶ | return ( join( "\n", 'On branch ' . ( $r->{branch} // 'HEAD' ), 'Changes not staged for commit:', ( map {"\t$_->[0]: $_->[1]"} @$un ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1473 | 2 | ▶ | ( @$ut ? ( 'Untracked files:', map {"\t$_"} @$ut ) : () ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1474 | 3 | ▶ | ( $sub eq 'pop' ? "Dropped refs/stash\@{$n} (" . $e->{id} . ')' : () ) ), 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{"branch"} // "HEAD"
MC/DC0%0/1
$$r{"branch"} // "HEAD"
$$r{"branch"}
Truth table50%1/2
A
A= $$r{"branch"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1475 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1476 | 1 | ▶ | if ( $sub eq 'drop' ) { splice @{ $r->{stash} }, $n, 1; return ( "Dropped refs/stash\@{$n} ($e->{id})", 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1477 | 0 | push @GAPS, "git stash $sub"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1478 | 0 | return ( '', 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1479 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1480 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1481 | # --autostash (oder rebase.autoStash): vor dem Rebase beiseite, danach zurueck | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1482 | 7 | ▶ | sub _autostash { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_autostash: called CC=12 SCAR=25.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1483 | 7 | my ( $dev, $root, $r, $a, $run ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1484 | 7 | ▶ | my %cfg = ( %{ ( $dev->{git} || {} )->{config} || {} }, %{ $r->{config} || {} } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
($$dev{'git'} || {})->{'config'} || {}
$$dev{'git'} || {}
$$r{'config'} || {}
MC/DC0%0/1
($$dev{'git'} || {})->{'config'} || {}
$$dev{'git'}
MC/DC100%1/1
$$r{'config'} || {}
$$r{'config'}
Truth table50%1/2
A
A= $$dev{'git'}
Truth table100%2/2
A
A= $$r{'config'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1485 | 7 | ▶ | my $on = ( grep { $_ eq '--autostash' } @$a ) ? 1 : ( grep { $_ eq '--no-autostash' } @$a ) ? 0 : ( $cfg{'rebase.autoStash'} // $cfg{'rebase.autostash'} // '' ) eq 'true'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition80%4/5
($cfg{"rebase.autoStash"} // $cfg{"rebase.autostash"}) // ""
$cfg{"rebase.autoStash"} // $cfg{"rebase.autostash"}
MC/DC50%1/2
($cfg{"rebase.autoStash"} // $cfg{"rebase.autostash"}) // ""
$cfg{"rebase.autoStash"}
$cfg{"rebase.autostash"}
Truth table66%2/3
A // B
A= $cfg{"rebase.autoStash"}B= $cfg{"rebase.autostash"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1486 | 7 | ▶ | return $run->() unless $on && _dirty( $dev, $root, $r ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$on and _dirty($dev, $root, $r)
MC/DC50%1/2
$on and _dirty($dev, $root, $r)
$on
_dirty($dev, $root, $r)
Truth table66%2/3
A and B
A= $onB= _dirty($dev, $root, $r)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1487 | 2 | my $e = _stash_save( $dev, $root, $r, undef, 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1488 | 2 | my ( $o, $ok, $keep ) = $run->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1489 | 2 | shift @{ $r->{stash} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1490 | 2 | my ( $ao, $aok ) = _stash_apply( $dev, $root, $r, $e ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1491 | 0 | ▶ | unshift @{ $r->{stash} }, $e unless $aok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1492 | 2 | ▶ | return ( join( "\n", 'Created autostash: ' . _short( $e->{id} ), grep( {length} $o ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1493 | $aok ? 'Applied autostash.' : "Applying autostash resulted in conflicts.\nYour changes are safe in the stash.\nYou can run \"git stash pop\" or \"git stash drop\" at any time." ), $ok, $keep ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1494 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1495 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1496 | 3 | ▶ | sub _g_rev_list { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_rev_list: called CC=27 SCAR=43.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1497 | 3 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1498 | 3 | my ( $count, $all, $n, @inc, @exc ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1499 | 3 | my @x = @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1500 | 3 | ▶ | while (@x) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1501 | 4 | my $v = shift @x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1502 | 4 | ▶ | if ( $v eq '--count' ) { $count = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 9 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1503 | 0 | elsif ( $v eq '--all' ) { $all = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1504 | 0 | ▶ | elsif ( $v =~ /\A(?:-n|--max-count=?)(\d*)\z/ ) { $n = length $1 ? $1 : shift @x } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1505 | 0 | elsif ( $v =~ /\A-(\d+)\z/ ) { $n = $1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1506 | elsif ( $v =~ /\A--(?:no-merges|first-parent|reverse|abbrev-commit)\z/ ) { } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1507 | 0 | elsif ( $v eq '--' ) { last } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1508 | 0 | elsif ( $v =~ /\A-/ ) { return ( "fatal: unrecognized argument: $v", 0 ) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1509 | 1 | ▶ | elsif ( $v =~ /\A(.*?)\.\.(.*)\z/ ) { push @exc, length $1 ? $1 : 'HEAD'; push @inc, length $2 ? $2 : 'HEAD' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1510 | 0 | elsif ( $v =~ /\A\^(.+)\z/ ) { push @exc, $1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1511 | 2 | else { push @inc, $v } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1513 | 0 | ▶ | my @tips = $all ? ( values %{ $r->{refs}{heads} || {} }, values %{ $r->{refs}{remotes} || {} }, map { $_->{commit} } values %{ $r->{refs}{tags} || {} } ) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$$r{'refs'}{'heads'} || {}
$$r{'refs'}{'remotes'} || {}
$$r{'refs'}{'tags'} || {}
MC/DC0%0/1
$$r{'refs'}{'heads'} || {}
$$r{'refs'}{'heads'}
MC/DC0%0/1
$$r{'refs'}{'remotes'} || {}
$$r{'refs'}{'remotes'}
MC/DC0%0/1
$$r{'refs'}{'tags'} || {}
$$r{'refs'}{'tags'}
Truth table0%0/2
A
A= $$r{'refs'}{'heads'}
Truth table0%0/2
A
A= $$r{'refs'}{'remotes'}
Truth table0%0/2
A
A= $$r{'refs'}{'tags'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1514 | 3 | ▶ | for (@inc) { push @tips, _rev( $r, $_ ) // return ( "fatal: ambiguous argument '$_': unknown revision or path not in the working tree.", 0 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
_rev($r, $_) // (return "fatal: ambiguous argument '${_}': unknown revision or path not in the working tree.", 0)
MC/DC0%0/1
_rev($r, $_) // (return "fatal: ambiguous argument '${_}': unknown revision or path not in the working tree.", 0)
_rev($r, $_)
Truth table50%1/2
A
A= _rev($r, $_)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1515 | 3 | ▶ | return ( "usage: git rev-list [<options>] <commit>... [--] [<path>...]", 0 ) unless @tips; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1516 | 3 | my %ex; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1517 | 3 | ▶ | for (@exc) { my $id = _rev( $r, $_ ) // return ( "fatal: ambiguous argument '$_': unknown revision or path not in the working tree.", 0 ); %ex = ( %ex, %{ _ancestors( $r, $id ) } ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
_rev($r, $_) // (return "fatal: ambiguous argument '${_}': unknown revision or path not in the working tree.", 0)
MC/DC0%0/1
_rev($r, $_) // (return "fatal: ambiguous argument '${_}': unknown revision or path not in the working tree.", 0)
_rev($r, $_)
Truth table50%1/2
A
A= _rev($r, $_)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1518 | 3 | my %s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1519 | 3 | ▶ | my @ids = _newest_first( $r, grep { !$s{$_}++ && !$ex{$_} } map { _range( $r, undef, $_ ) } @tips ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$s{$_}++ || $ex{$_}
MC/DC50%1/2
$s{$_}++ || $ex{$_}
$s{$_}++
$ex{$_}
Truth table66%2/3
A || B
A= $s{$_}++B= $ex{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1520 | 3 | ▶ | splice @ids, $n if defined $n && $n < @ids; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $n and $n < @ids
MC/DC0%0/2
defined $n and $n < @ids
defined $n
$n < @ids
Truth table33%1/3
A and B
A= defined $nB= $n < @ids
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1521 | 3 | ▶ | return ( $count ? scalar(@ids) : join( "\n", @ids ), 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1522 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1524 | # reflog: aus der Geschichte des Zweigs (der Simulator fuehrt kein eigenes Protokoll) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1525 | 1 | ▶ | sub _g_reflog { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_reflog: called CC=7 SCAR=21.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1526 | 1 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1527 | 1 | my @x = grep { $_ ne 'show' } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1528 | 1 | ▶ | my ($n) = map { /\A-n(\d+)\z|\A-(\d+)\z/ ? $1 // $2 : () } @x; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$1 // $2
MC/DC0%0/2
$1 // $2
$1
$2
Truth table33%1/3
A // B
A= $1B= $2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1529 | 1 | my @ids = reverse _range( $r, undef, _head($r) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1530 | 1 | ▶ | splice @ids, $n if defined $n && $n < @ids; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $n and $n < @ids
MC/DC0%0/2
defined $n and $n < @ids
defined $n
$n < @ids
Truth table33%1/3
A and B
A= defined $nB= $n < @ids
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1531 | 1 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1532 | 1 | ▶ | return ( join( "\n", map { my $c = $r->{commits}{$_}; _short($_) . ' HEAD@{' . $i++ . '}: ' . ( @{ $c->{parents} || [] } ? 'commit' : 'commit (initial)' ) . ': ' . _subject( $c->{message} ) } @ids ), 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$c{'parents'} || []
MC/DC0%0/1
$$c{'parents'} || []
$$c{'parents'}
Truth table50%1/2
A
A= $$c{'parents'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1533 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1535 | 2 | ▶ | sub _g_merge_base { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_merge_base: called CC=6 SCAR=18.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1536 | 2 | my ( $dev, $root, $r, $a ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1537 | 2 | my $anc = grep { $_ eq '--is-ancestor' } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1538 | 2 | my @x = grep { !/\A-/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1539 | 2 | ▶ | return ( 'usage: git merge-base [-a | --all] <commit> <commit>...', 0 ) unless @x == 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1540 | 2 | ▶ | my @id = map { _rev( $r, $_ ) // return ( "fatal: Not a valid object name $_", 0 ) } @x; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
_rev($r, $_) // (return "fatal: Not a valid object name $_", 0)
MC/DC0%0/1
_rev($r, $_) // (return "fatal: Not a valid object name $_", 0)
_rev($r, $_)
Truth table50%1/2
A
A= _rev($r, $_)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1541 | 2 | ▶ | return ( '', _ancestors( $r, $id[1] )->{ $id[0] } ? 1 : 0 ) if $anc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1542 | 1 | ▶ | my $b = _base( $r, @id ) // return ( '', 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
_base($r, @id) // (return "", 0)
MC/DC0%0/1
_base($r, @id) // (return "", 0)
_base($r, @id)
Truth table50%1/2
A
A= _base($r, @id)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1543 | 1 | return ( $b, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1544 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1545 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1546 | 0 | ▶ | sub _g_fsck { return ( "Checking object directories: 100% (256/256), done.", 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_fsck: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1547 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1548 | 0 | ▶ | sub _g_describe { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_describe: not called CC=16 SCAR=56.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1549 | 0 | my ( $dev, $root, $r, $args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1550 | 0 | ▶ | my $all = grep { $_ eq '--tags' || $_ eq '--all' } @$args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$_ eq '--tags' || $_ eq '--all'
MC/DC0%0/2
$_ eq '--tags' || $_ eq '--all'
$_ eq '--tags'
$_ eq '--all'
Truth table0%0/3
A || B
A= $_ eq '--tags'B= $_ eq '--all'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1551 | 0 | my ($rev) = grep { !/\A-/ } @$args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1552 | 0 | ▶ | my $id = _rev( $r, $rev // 'HEAD' ) // return ( "fatal: Not a valid object name " . ( $rev // 'HEAD' ), 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
_rev($r, $rev // "HEAD") // (return 'fatal: Not a valid object name ' . ($rev // "HEAD"), 0)
$rev // "HEAD"
$rev // "HEAD"
MC/DC0%0/1
_rev($r, $rev // "HEAD") // (return 'fatal: Not a valid object name ' . ($rev // "HEAD"), 0)
_rev($r, $rev // "HEAD")
MC/DC0%0/1
$rev // "HEAD"
$rev
MC/DC0%0/1
$rev // "HEAD"
$rev
Truth table0%0/2
A
A= _rev($r, $rev // "HEAD")
Truth table0%0/2
A
A= $rev
Truth table0%0/2
A
A= $rev
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1553 | 0 | my %tag; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1554 | 0 | ▶ | for my $t ( keys %{ $r->{refs}{tags} || {} } ) { push @{ $tag{ $r->{refs}{tags}{$t}{commit} } }, $t if $all || $r->{refs}{tags}{$t}{annotated} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$$r{'refs'}{'tags'} || {}
$all or $$r{"refs"}{"tags"}{$t}{"annotated"}
MC/DC0%0/1
$$r{'refs'}{'tags'} || {}
$$r{'refs'}{'tags'}
MC/DC0%0/2
$all or $$r{"refs"}{"tags"}{$t}{"annotated"}
$all
$$r{"refs"}{"tags"}{$t}{"annotated"}
Truth table0%0/2
A
A= $$r{'refs'}{'tags'}
Truth table0%0/3
A or B
A= $allB= $$r{"refs"}{"tags"}{$t}{"annotated"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1555 | 0 | my @q = ( [ $id, 0 ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1556 | 0 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1557 | 0 | ▶ | while (@q) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1558 | 0 | my ( $x, $d ) = @{ shift @q }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1559 | 0 | ▶ | next if $seen{$x}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1560 | 0 | ▶ | if ( $tag{$x} ) { my ($t) = sort @{ $tag{$x} }; return ( $d ? "$t-$d-g" . _short($id) : $t, 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1561 | 0 | ▶ | push @q, map { [ $_, $d + 1 ] } @{ ( $r->{commits}{$x} || {} )->{parents} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
($$r{'commits'}{$x} || {})->{'parents'} || []
$$r{'commits'}{$x} || {}
MC/DC0%0/1
($$r{'commits'}{$x} || {})->{'parents'} || []
$$r{'commits'}{$x}
Truth table0%0/2
A
A= $$r{'commits'}{$x}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1563 | 0 | ▶ | return ( $all ? 'fatal: No names found, cannot describe anything.' : "fatal: No annotated tags can describe '$id'.\nHowever, there were unannotated tags: try --tags.", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1564 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1565 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1566 | 0 | ▶ | sub _g_ls_remote { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_ls_remote: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1567 | 0 | my ( $dev, $root, $r, $a, $ctx ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1568 | 0 | my ($remote) = grep { !/\A-/ } @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1569 | 0 | my ( $s, $err ) = _server( $ctx, $r, $remote ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1570 | 0 | ▶ | return ( $err, 0 ) unless $s; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1571 | 0 | ▶ | my @l = map {"$s->{refs}{heads}{$_}\trefs/heads/$_"} sort keys %{ $s->{refs}{heads} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$s{'refs'}{'heads'} || {}
MC/DC0%0/1
$$s{'refs'}{'heads'} || {}
$$s{'refs'}{'heads'}
Truth table0%0/2
A
A= $$s{'refs'}{'heads'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1572 | 0 | ▶ | push @l, map {"$s->{refs}{tags}{$_}{commit}\trefs/tags/$_"} sort keys %{ $s->{refs}{tags} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$s{'refs'}{'tags'} || {}
MC/DC0%0/1
$$s{'refs'}{'tags'} || {}
$$s{'refs'}{'tags'}
Truth table0%0/2
A
A= $$s{'refs'}{'tags'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1573 | 0 | return ( join( "\n", @l ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1574 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1575 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1576 | # Regeln des pre-receive-Hooks: erste Verletzung -> Text oder undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1577 | 8 | ▶ | sub _policy { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_policy: called CC=15 SCAR=28.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1578 | 8 | my ( $srv, $s, $ids, $ref ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1579 | 8 | my $hook = $s->{hook}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1580 | 8 | ▶ | if ( defined $hook ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1581 | 8 | ▶ | my $e = ( $srv->{files} || {} )->{$hook}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$srv{'files'} || {}
MC/DC0%0/1
$$srv{'files'} || {}
$$srv{'files'}
Truth table50%1/2
A
A= $$srv{'files'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1582 | 8 | ▶ | return undef unless defined $e; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1583 | 8 | require Langertha::Holmgang::Sim::Linux; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1584 | 8 | ▶ | return undef unless Langertha::Holmgang::Sim::Linux::_can( $srv, 'git', $hook, 'x' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1585 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1586 | 7 | ▶ | for my $p ( @{ $s->{policy} || [] } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$s{'policy'} || []
MC/DC0%0/1
$$s{'policy'} || []
$$s{'policy'}
Truth table50%1/2
A
A= $$s{'policy'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1587 | 12 | ▶ | next if defined $p->{refs} && $ref !~ /$p->{refs}/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $$p{"refs"} and not $ref =~ /$$p{"refs"}/
MC/DC0%0/2
defined $$p{"refs"} and not $ref =~ /$$p{"refs"}/
defined $$p{"refs"}
not $ref =~ /$$p{"refs"}/
Truth table33%1/3
A and not(B)
A= defined $$p{"refs"}B= not $ref =~ /$$p{"refs"}/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1588 | 12 | for my $id (@$ids) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1589 | 10 | ▶ | my $c = $s->{_new}{$id} or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1590 | my $bad = $p->{kind} eq 'message' ? $c->{message} !~ /$p->{regex}/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1591 | : $p->{kind} eq 'author' ? $c->{author} !~ /$p->{regex}/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1592 | 10 | ▶ | : $p->{kind} eq 'path' ? scalar( grep {/$p->{regex}/} keys %{ $c->{tree} } ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1593 | : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1594 | 10 | ▶ | next unless $bad; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1595 | 3 | my $t = $p->{text}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1596 | 3 | $t =~ s/\{commit\}/_short($id)/ge; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1597 | 3 | $t =~ s/\{subject\}/_subject( $c->{message} )/ge; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1598 | 3 | $t =~ s/\{author\}/$c->{author}/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1599 | 3 | return $t; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1600 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1601 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1602 | 4 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1603 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1604 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1605 | 10 | ▶ | sub _g_push { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_g_push: called CC=120 SCAR=73.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1606 | 10 | my ( $dev, $root, $r, $a, $ctx ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1607 | 10 | my ( $force, $lease, $tags, $setup, $follow, $delete, $dry ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1608 | 10 | my @p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1609 | 10 | for (@$a) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1610 | 7 | ▶ | if ( $_ eq '--force' || $_ eq '-f' ) { $force = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 9 branches
Condition100%3/3
$_ eq "--force" or $_ eq "-f"
MC/DC100%2/2
$_ eq "--force" or $_ eq "-f"
$_ eq "--force"
$_ eq "-f"
Truth table100%3/3
A or B
A= $_ eq "--force"B= $_ eq "-f"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1611 | 0 | elsif (/\A--force-with-lease/) { $lease = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1612 | 0 | elsif ( $_ eq '--tags' ) { $tags = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1613 | 0 | elsif ( $_ eq '--follow-tags' ) { $follow = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1614 | 0 | ▶ | elsif ( $_ eq '-u' || $_ eq '--set-upstream' ) { $setup = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$_ eq "-u" or $_ eq "--set-upstream"
MC/DC0%0/2
$_ eq "-u" or $_ eq "--set-upstream"
$_ eq "-u"
$_ eq "--set-upstream"
Truth table33%1/3
A or B
A= $_ eq "-u"B= $_ eq "--set-upstream"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1615 | 0 | ▶ | elsif ( $_ eq '-d' || $_ eq '--delete' ) { $delete = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$_ eq "-d" or $_ eq "--delete"
MC/DC0%0/2
$_ eq "-d" or $_ eq "--delete"
$_ eq "-d"
$_ eq "--delete"
Truth table33%1/3
A or B
A= $_ eq "-d"B= $_ eq "--delete"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1616 | 0 | ▶ | elsif ( $_ eq '-n' || $_ eq '--dry-run' ) { $dry = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$_ eq "-n" or $_ eq "--dry-run"
MC/DC0%0/2
$_ eq "-n" or $_ eq "--dry-run"
$_ eq "-n"
$_ eq "--dry-run"
Truth table33%1/3
A or B
A= $_ eq "-n"B= $_ eq "--dry-run"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1617 | ▶ | elsif ( $_ eq '--no-verify' || $_ eq '-q' || $_ eq '--quiet' || $_ eq '-v' ) { } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%6/9
$_ eq "--no-verify" or $_ eq "-q" or $_ eq "--quiet" or $_ eq "-v"
$_ eq "--no-verify" or $_ eq "-q" or $_ eq "--quiet"
$_ eq "--no-verify" or $_ eq "-q"
MC/DC25%1/4
$_ eq "--no-verify" or $_ eq "-q" or $_ eq "--quiet" or $_ eq "-v"
$_ eq "--no-verify"
$_ eq "-q"
$_ eq "--quiet"
$_ eq "-v"
Truth table40%2/5
A or B or C or D
A= $_ eq "--no-verify"B= $_ eq "-q"C= $_ eq "--quiet"D= $_ eq "-v"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1618 | 0 | elsif (/\A-/) { return ( "error: unknown option `" . s/\A-+//r . "'", 0 ) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1619 | 4 | else { push @p, $_ } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1620 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1621 | 10 | ▶ | my $remote = shift(@p) // 'origin'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift @p // "origin"
MC/DC100%1/1
shift @p // "origin"
shift @p
Truth table100%2/2
A
A= shift @p
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1622 | 10 | my ( $s, $err, $rm, $srv ) = _server( $ctx, $r, $remote ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1623 | 10 | ▶ | return ( $err, 0 ) unless $s; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1624 | 10 | my @specs; # [ lokal-id, ziel-ref, art, name, erzwingen ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1625 | 10 | my $b = $r->{branch}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1626 | 10 | ▶ | if ( !@p && !$tags ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@p or $tags
MC/DC50%1/2
@p or $tags
@p
$tags
Truth table66%2/3
A or B
A= @pB= $tags
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1627 | 8 | ▶ | return ( "fatal: You are not currently on a branch.", 0 ) unless defined $b; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1628 | return ( "fatal: The current branch $b has no upstream branch.\nTo push the current branch and set the remote as upstream, use\n\n git push --set-upstream $remote $b\n", 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1629 | 8 | ▶ | unless exists( ( $r->{refs}{remotes} || {} )->{"$remote/$b"} ) || $setup; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition40%2/5
exists(($$r{"refs"}{"remotes"} || {})->{"$remote/$b"}) or $setup
$$r{'refs'}{'remotes'} || {}
MC/DC0%0/2
exists(($$r{"refs"}{"remotes"} || {})->{"$remote/$b"}) or $setup
$$r{'refs'}{'remotes'}
$setup
Truth table33%1/3
A or B
A= $$r{'refs'}{'remotes'}B= $setup
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1630 | 8 | @p = ($b); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1631 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1632 | 10 | for my $spec (@p) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1633 | 10 | ▶ | my $f = $spec =~ s/\A\+// ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1634 | 10 | my ( $src, $dst ) = split /:/, $spec, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1635 | 10 | ▶ | $dst //= $src; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$dst //= $src
MC/DC0%0/2
$dst //= $src
$dst
$src
Truth table33%1/3
A //= B
A= $dstB= $src
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1636 | 10 | ▶ | $src =~ s{\Arefs/(?:heads|tags)/}{} if defined $src; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1637 | 10 | ▶ | $src = $b if $src eq 'HEAD' && defined $b; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$src eq "HEAD" and defined $b
MC/DC0%0/2
$src eq "HEAD" and defined $b
$src eq "HEAD"
defined $b
Truth table33%1/3
A and B
A= $src eq "HEAD"B= defined $b
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1638 | 10 | ▶ | $dst = $b if $dst eq 'HEAD' && defined $b; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$dst eq "HEAD" and defined $b
MC/DC0%0/2
$dst eq "HEAD" and defined $b
$dst eq "HEAD"
defined $b
Truth table33%1/3
A and B
A= $dst eq "HEAD"B= defined $b
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1639 | 10 | ▶ | if ( $delete || ( defined $src && $src eq '' ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$delete or defined $src and $src eq ""
defined $src and $src eq ""
MC/DC0%0/3
$delete or defined $src and $src eq ""
$delete
defined $src
$src eq ""
Truth table25%1/4
A or B and C
A= $deleteB= defined $srcC= $src eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1640 | 0 | ( my $n = $dst ) =~ s{\Arefs/(?:heads|tags)/}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1641 | 0 | ▶ | my $kind = $dst =~ m{\Arefs/tags/} ? 'tag' : $dst =~ m{\Arefs/heads/} ? 'head' : exists( ( $s->{refs}{tags} || {} )->{$n} ) && !exists( ( $s->{refs}{heads} || {} )->{$n} ) ? 'tag' : 'head'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/7
exists(($$s{"refs"}{"tags"} || {})->{$n}) and not exists(($$s{"refs"}{"heads"} || {})->{$n})
$$s{'refs'}{'tags'} || {}
$$s{'refs'}{'heads'} || {}
MC/DC0%0/2
exists(($$s{"refs"}{"tags"} || {})->{$n}) and not exists(($$s{"refs"}{"heads"} || {})->{$n})
$$s{'refs'}{'tags'}
$$s{'refs'}{'heads'}
Truth table0%0/3
A and not(B)
A= $$s{'refs'}{'tags'}B= $$s{'refs'}{'heads'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1642 | 0 | push @specs, [ undef, $n, $kind, $n, 1 ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1643 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1644 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1645 | 10 | ▶ | if ( ( $r->{refs}{tags} || {} )->{$src} && !exists( ( $r->{refs}{heads} || {} )->{$src} ) ) { push @specs, [ $r->{refs}{tags}{$src}{commit}, $dst =~ s{\Arefs/tags/}{}r, 'tag', $src, $f ]; next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition57%4/7
($$r{"refs"}{"tags"} || {})->{$src} and not exists(($$r{"refs"}{"heads"} || {})->{$src})
$$r{'refs'}{'tags'} || {}
$$r{'refs'}{'heads'} || {}
MC/DC0%0/2
($$r{"refs"}{"tags"} || {})->{$src} and not exists(($$r{"refs"}{"heads"} || {})->{$src})
$$r{'refs'}{'tags'}
$$r{'refs'}{'heads'}
Truth table33%1/3
A and not(B)
A= $$r{'refs'}{'tags'}B= $$r{'refs'}{'heads'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1646 | 9 | ▶ | my $id = _rev( $r, $src ) // return ( "error: src refspec $src does not match any\nerror: failed to push some refs to '$rm->{url}'", 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
_rev($r, $src) // (return qq[error: src refspec $src does not match any\nerror: failed to push some refs to '$$rm{"url"}'], 0)
MC/DC0%0/1
_rev($r, $src) // (return qq[error: src refspec $src does not match any\nerror: failed to push some refs to '$$rm{"url"}'], 0)
_rev($r, $src)
Truth table50%1/2
A
A= _rev($r, $src)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1647 | 9 | push @specs, [ $id, $dst =~ s{\Arefs/heads/}{}r, 'head', $src, $f ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1648 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1649 | 10 | ▶ | if ( $tags || $follow ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$tags or $follow
MC/DC0%0/2
$tags or $follow
$tags
$follow
Truth table33%1/3
A or B
A= $tagsB= $follow
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1650 | 0 | ▶ | for my $tg ( sort keys %{ $r->{refs}{tags} || {} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$r{'refs'}{'tags'} || {}
MC/DC0%0/1
$$r{'refs'}{'tags'} || {}
$$r{'refs'}{'tags'}
Truth table0%0/2
A
A= $$r{'refs'}{'tags'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1651 | 0 | ▶ | next if $follow && !$tags && !$r->{refs}{tags}{$tg}{annotated}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$follow and not $tags and not $$r{"refs"}{"tags"}{$tg}{"annotated"}
$follow and not $tags
MC/DC0%0/3
$follow and not $tags and not $$r{"refs"}{"tags"}{$tg}{"annotated"}
$follow
not $tags
not $$r{"refs"}{"tags"}{$tg}{"annotated"}
Truth table0%0/4
A and not(B) and not(C)
A= $followB= not $tagsC= not $$r{"refs"}{"tags"}{$tg}{"annotated"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1652 | 0 | ▶ | next if grep { $_->[2] eq 'tag' && $_->[1] eq $tg } @specs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$$_[2] eq 'tag' && $$_[1] eq $tg
MC/DC0%0/2
$$_[2] eq 'tag' && $$_[1] eq $tg
$$_[2] eq 'tag'
$$_[1] eq $tg
Truth table0%0/3
A && B
A= $$_[2] eq 'tag'B= $$_[1] eq $tg
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1653 | 0 | push @specs, [ $r->{refs}{tags}{$tg}{commit}, $tg, 'tag', $tg, 0 ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1654 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1655 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1656 | 10 | my @out = ("To $rm->{url}"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1657 | 10 | my $fail = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1658 | 10 | my $hook_msg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1659 | 10 | for my $sp (@specs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1660 | 10 | my ( $id, $ref, $kind, $name, $f ) = @$sp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1661 | 10 | ▶ | my $cur = $kind eq 'tag' ? ( ( $s->{refs}{tags} || {} )->{$ref} || {} )->{commit} : ( $s->{refs}{heads} || {} )->{$ref}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
($$s{'refs'}{'tags'} || {})->{$ref} || {}
$$s{'refs'}{'tags'} || {}
$$s{'refs'}{'heads'} || {}
MC/DC0%0/1
($$s{'refs'}{'tags'} || {})->{$ref} || {}
$$s{'refs'}{'tags'}
MC/DC0%0/1
$$s{'refs'}{'heads'} || {}
$$s{'refs'}{'heads'}
Truth table50%1/2
A
A= $$s{'refs'}{'tags'}
Truth table50%1/2
A
A= $$s{'refs'}{'heads'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1662 | 10 | ▶ | if ( !defined $id ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1663 | 0 | ▶ | if ( !defined $cur ) { push @out, " ! [remote rejected] $ref (not found)"; $fail = 1; next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1664 | 0 | ▶ | if ( $kind eq 'head' && exists( ( $s->{protected} || {} )->{$ref} ) ) { push @out, " ! [remote rejected] $ref (protected branch)"; $hook_msg //= "remote: \nremote: Forgejo: branch $ref is protected from deletion"; $fail = 1; next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/7
$kind eq "head" and exists(($$s{"protected"} || {})->{$ref})
$$s{'protected'} || {}
$hook_msg //= "remote: \nremote: Forgejo: branch $ref is protected from deletion"
MC/DC0%0/2
$kind eq "head" and exists(($$s{"protected"} || {})->{$ref})
$kind eq "head"
$$s{'protected'}
MC/DC0%0/1
$hook_msg //= "remote: \nremote: Forgejo: branch $ref is protected from deletion"
$hook_msg
Truth table0%0/3
A and B
A= $kind eq "head"B= $$s{'protected'}
Truth table0%0/2
A
A= $hook_msg
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1665 | 0 | ▶ | next if $dry; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1666 | 0 | ▶ | if ( $kind eq 'tag' ) { delete $s->{refs}{tags}{$ref} } else { delete $s->{refs}{heads}{$ref}; delete $r->{refs}{remotes}{"$remote/$ref"} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1667 | 0 | push @out, " - [deleted] $ref"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1668 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1669 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1670 | 0 | ▶ | if ( defined $cur && $cur eq $id && !( $kind eq 'tag' && $r->{refs}{tags}{$name}{annotated} && !( $s->{refs}{tags}{$ref} || {} )->{annotated} ) ) { push @out, " = [up to date] $name -> $ref" if @p; next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition21%3/14
defined $cur and $cur eq $id and not $kind eq "tag" && $$r{"refs"}{"tags"}{$name}{"annotated"} && !($$s{"refs"}{"tags"}{$ref} || {})->{"annotated"}
defined $cur and $cur eq $id
$kind eq 'tag' && $$r{'refs'}{'tags'}{$name}{'annotated'} && !($$s{'refs'}{'tags'}{$ref} || {})->{'annotated'}
$kind eq "tag" and $$r{"refs"}{"tags"}{$name}{"annotated"}
$$s{'refs'}{'tags'}{$ref} || {}
MC/DC0%0/5
defined $cur and $cur eq $id and not $kind eq "tag" && $$r{"refs"}{"tags"}{$name}{"annotated"} && !($$s{"refs"}{"tags"}{$ref} || {})->{"annotated"}
defined $cur
$cur eq $id
$kind eq "tag"
$$r{"refs"}{"tags"}{$name}{"annotated"}
$$s{'refs'}{'tags'}{$ref}
Truth table33%2/6
A and B and not(C and D && not(E))
A= defined $curB= $cur eq $idC= $kind eq "tag"D= $$r{"refs"}{"tags"}{$name}{"annotated"}E= $$s{'refs'}{'tags'}{$ref}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1671 | 10 | ▶ | my $known = defined $cur ? exists $r->{commits}{$cur} : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1672 | 10 | ▶ | my $ff = !defined $cur || $known && _ancestors( $r, $id )->{$cur}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
!defined($cur) || $known && _ancestors($r, $id)->{$cur}
$known and _ancestors($r, $id)->{$cur}
MC/DC66%2/3
!defined($cur) || $known && _ancestors($r, $id)->{$cur}
!defined($cur)
$known
_ancestors($r, $id)->{$cur}
Truth table75%3/4
not(A) || B and C
A= !defined($cur)B= $knownC= _ancestors($r, $id)->{$cur}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1673 | 0 | ▶ | if ( $kind eq 'tag' && defined $cur && !$force && !$f ) { push @out, " ! [rejected] $name -> $ref (already exists)"; $fail = 1; next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition44%4/9
$kind eq "tag" and defined $cur and not $force and not $f
$kind eq "tag" and defined $cur and not $force
$kind eq "tag" and defined $cur
MC/DC0%0/4
$kind eq "tag" and defined $cur and not $force and not $f
$kind eq "tag"
defined $cur
not $force
not $f
Truth table40%2/5
A and B and not(C) and not(D)
A= $kind eq "tag"B= defined $curC= not $forceD= not $f
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1674 | 10 | ▶ | if ( !$ff && !$force && !$f ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$ff or $force or $f
$ff or $force
MC/DC66%2/3
$ff or $force or $f
$ff
$force
$f
Truth table75%3/4
A or B or C
A= $ffB= $forceC= $f
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1675 | 1 | ▶ | my $lease_ok = $lease && defined( ( $r->{refs}{remotes} || {} )->{"$remote/$ref"} ) && $r->{refs}{remotes}{"$remote/$ref"} eq $cur; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%2/8
$lease && defined(($$r{'refs'}{'remotes'} || {})->{"$remote/$ref"}) && $$r{'refs'}{'remotes'}{"$remote/$ref"} eq $cur
$lease and defined(($$r{"refs"}{"remotes"} || {})->{"$remote/$ref"})
$$r{'refs'}{'remotes'} || {}
MC/DC0%0/3
$lease && defined(($$r{'refs'}{'remotes'} || {})->{"$remote/$ref"}) && $$r{'refs'}{'remotes'}{"$remote/$ref"} eq $cur
$lease
$$r{'refs'}{'remotes'}
$$r{'refs'}{'remotes'}{"$remote/$ref"} eq $cur
Truth table25%1/4
A and B && C
A= $leaseB= $$r{'refs'}{'remotes'}C= $$r{'refs'}{'remotes'}{"$remote/$ref"} eq $cur
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1676 | 1 | ▶ | unless ($lease_ok) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1677 | 1 | ▶ | push @out, " ! [" . ( $lease ? 'rejected' : 'rejected' ) . "] $name -> $ref " . ( $lease ? '(stale info)' : $known ? '(non-fast-forward)' : '(fetch first)' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1678 | 1 | $fail = 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1679 | 1 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1680 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1681 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1682 | 9 | ▶ | if ( !$ff && $kind eq 'head' && exists( ( $s->{protected} || {} )->{$ref} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition87%7/8
not $ff and $kind eq "head" and exists(($$s{"protected"} || {})->{$ref})
not $ff and $kind eq "head"
$$s{'protected'} || {}
MC/DC66%2/3
not $ff and $kind eq "head" and exists(($$s{"protected"} || {})->{$ref})
not $ff
$kind eq "head"
$$s{'protected'}
Truth table75%3/4
not(A) and B and C
A= not $ffB= $kind eq "head"C= $$s{'protected'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1683 | 1 | push @out, " ! [remote rejected] $name -> $ref (pre-receive hook declined)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1684 | 1 | ▶ | $hook_msg //= "remote: \nremote: Forgejo: branch $ref is protected from force push"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$hook_msg //= "remote: \nremote: Forgejo: branch $ref is protected from force push"
MC/DC0%0/1
$hook_msg //= "remote: \nremote: Forgejo: branch $ref is protected from force push"
$hook_msg
Truth table50%1/2
A
A= $hook_msg
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1685 | 1 | $fail = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1686 | 1 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1687 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1688 | 8 | ▶ | my $prot = ( $s->{protected} || {} )->{$ref}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$$s{'protected'} || {}
MC/DC100%1/1
$$s{'protected'} || {}
$$s{'protected'}
Truth table100%2/2
A
A= $$s{'protected'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1689 | 8 | ▶ | if ( $kind eq 'head' && ref $prot eq 'HASH' && exists $prot->{push} && !$prot->{push} ) { # nur ueber Pull-Request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
$kind eq "head" and ref $prot eq "HASH" and exists $$prot{"push"} and not $$prot{"push"}
$kind eq "head" and ref $prot eq "HASH" and exists $$prot{"push"}
$kind eq "head" and ref $prot eq "HASH"
MC/DC0%0/4
$kind eq "head" and ref $prot eq "HASH" and exists $$prot{"push"} and not $$prot{"push"}
$kind eq "head"
ref $prot eq "HASH"
exists $$prot{"push"}
not $$prot{"push"}
Truth table60%3/5
A and B and C and not(D)
A= $kind eq "head"B= ref $prot eq "HASH"C= exists $$prot{"push"}D= not $$prot{"push"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1690 | 0 | push @out, " ! [remote rejected] $name -> $ref (pre-receive hook declined)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1691 | 0 | ▶ | $hook_msg //= "remote: \nremote: Forgejo: Not allowed to push to protected branch $ref"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$hook_msg //= "remote: \nremote: Forgejo: Not allowed to push to protected branch $ref"
MC/DC0%0/1
$hook_msg //= "remote: \nremote: Forgejo: Not allowed to push to protected branch $ref"
$hook_msg
Truth table0%0/2
A
A= $hook_msg
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1692 | 0 | $fail = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1693 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1694 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1695 | # neue Commits fuer die Hook-Regeln | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1696 | 8 | my @new = grep { !$s->{commits}{$_} } _range( $r, undef, $id ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1697 | 8 | local $s->{_new} = { map { $_ => $r->{commits}{$_} } @new }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1698 | 8 | ▶ | if ( defined( my $why = _policy( $srv, $s, \@new, $kind eq 'tag' ? "refs/tags/$ref" : "refs/heads/$ref" ) ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1699 | 3 | push @out, " ! [remote rejected] $name -> $ref (pre-receive hook declined)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1700 | 3 | ▶ | $hook_msg //= join "\n", map {"remote: $_"} split /\n/, $why; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$hook_msg //= join("\n", map({"remote: $_";} split(/\n/, $why, 0)))
MC/DC0%0/1
$hook_msg //= join("\n", map({"remote: $_";} split(/\n/, $why, 0)))
$hook_msg
Truth table50%1/2
A
A= $hook_msg
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1701 | 3 | $fail = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1702 | 3 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1703 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1704 | 5 | ▶ | next if $dry; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1705 | 5 | ▶ | $s->{commits}{$_} //= _clone( $r->{commits}{$_} ) for @new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$$s{"commits"}{$_} //= _clone($$r{"commits"}{$_})
MC/DC0%0/2
$$s{"commits"}{$_} //= _clone($$r{"commits"}{$_})
$$s{"commits"}{$_}
_clone($$r{"commits"}{$_})
Truth table33%1/3
A //= B
A= $$s{"commits"}{$_}B= _clone($$r{"commits"}{$_})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1706 | 5 | ▶ | if ( $kind eq 'tag' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1707 | 1 | $s->{refs}{tags}{$ref} = _clone( $r->{refs}{tags}{$name} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1708 | 1 | push @out, sprintf( ' * [new tag] %s -> %s', $name, $ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1709 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1710 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1711 | 4 | $s->{refs}{heads}{$ref} = $id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1712 | 4 | $r->{refs}{remotes}{"$remote/$ref"} = $id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1713 | 4 | ▶ | push @out, !defined $cur ? sprintf( ' * [new branch] %s -> %s', $name, $ref ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1714 | : $ff ? sprintf( ' %s..%s %s -> %s', _short($cur), _short($id), $name, $ref ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1715 | : sprintf( ' + %s...%s %s -> %s (forced update)', _short($cur), _short($id), $name, $ref ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1716 | 4 | $s->{pushes}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1717 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1718 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1719 | 10 | ▶ | if ($fail) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1720 | 5 | ▶ | unshift @out, $hook_msg if defined $hook_msg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1721 | 5 | push @out, "error: failed to push some refs to '$rm->{url}'"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1722 | 5 | ▶ | push @out, "hint: Updates were rejected because the remote contains work that you do not\nhint: have locally. This is usually caused by another repository pushing to\nhint: the same ref. If you want to integrate the remote changes, use\nhint: 'git pull' before pushing again.\nhint: See the 'Note about fast-forwards' in 'git push --help' for details." if $fail == 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1723 | 5 | return ( join( "\n", @out ), 0, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1724 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1725 | 5 | ▶ | push @out, "branch '$b' set up to track '$remote/$b'." if $setup && defined $b; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$setup and defined $b
MC/DC0%0/2
$setup and defined $b
$setup
defined $b
Truth table33%1/3
A and B
A= $setupB= defined $b
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1726 | 5 | view($s); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1727 | 5 | ▶ | return ( @out > 1 ? join( "\n", @out ) : 'Everything up-to-date', 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1728 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1729 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1730 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1731 | 8 | ▶ | sub view { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
view: called CC=6 SCAR=18.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1732 | 8 | my ($s) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1733 | 8 | my %v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1734 | 8 | ▶ | for my $b ( keys %{ $s->{refs}{heads} || {} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$s{'refs'}{'heads'} || {}
MC/DC0%0/1
$$s{'refs'}{'heads'} || {}
$$s{'refs'}{'heads'}
Truth table50%1/2
A
A= $$s{'refs'}{'heads'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1735 | 8 | my $tip = $s->{refs}{heads}{$b}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1736 | 8 | ▶ | my $c = $s->{commits}{$tip} or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1737 | 8 | ▶ | $v{$b} = { message => $c->{message}, author => $c->{author}, tree => _clone( $c->{tree} ), parents => scalar @{ $c->{parents} || [] }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$c{'parents'} || []
MC/DC0%0/1
$$c{'parents'} || []
$$c{'parents'}
Truth table50%1/2
A
A= $$c{'parents'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1738 | 8 | ▶ | log => [ map { my $x = $s->{commits}{$_}; +{ id => $_, message => $x->{message}, author => $x->{author}, parents => scalar @{ $x->{parents} || [] } } } reverse _range( $s, undef, $tip ) ] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$x{'parents'} || []
MC/DC0%0/1
$$x{'parents'} || []
$$x{'parents'}
Truth table50%1/2
A
A= $$x{'parents'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1739 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1740 | 8 | $s->{view} = \%v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1741 | 8 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1742 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1743 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1744 | # --- forgejo-runner ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1745 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1746 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1747 | 3 | ▶ | sub runner { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
runner: called CC=50 SCAR=55.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1748 | 3 | my ( $dev, $av, $ctx, $cwd, $user ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1749 | 3 | my @a = @$av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1750 | 3 | my $usage = "A runner for Forgejo Actions\n\nUsage:\n forgejo-runner [flags]\n forgejo-runner [command]\n\nAvailable Commands:\n" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1751 | . " cache-server Start a cache server for the cache action\n completion Generate the autocompletion script for the specified shell\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1752 | . " create-runner-file Create a runner file using a shared secret used to pre-register the runner on the Forgejo instance\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1753 | . " daemon Run as a runner daemon\n exec Run workflow locally.\n generate-config Generate an example config file\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1754 | . " help Help about any command\n register Register a runner to the server\n\nFlags:\n -c, --config string config file path\n -h, --help help for forgejo-runner\n -v, --version version for forgejo-runner"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1755 | 3 | ▶ | my $verb = shift(@a) // return ( $usage, 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift @a // (return $usage, 1)
MC/DC0%0/1
shift @a // (return $usage, 1)
shift @a
Truth table50%1/2
A
A= shift @a
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1756 | 3 | ▶ | return ( $usage, 1 ) if $verb eq '--help' || $verb eq '-h' || $verb eq 'help' && !@a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$verb eq "--help" or $verb eq "-h" or $verb eq "help" and not @a
$verb eq "--help" or $verb eq "-h"
$verb eq "help" and not @a
MC/DC0%0/4
$verb eq "--help" or $verb eq "-h" or $verb eq "help" and not @a
$verb eq "--help"
$verb eq "-h"
$verb eq "help"
not @a
Truth table20%1/5
A or B or C and not(D)
A= $verb eq "--help"B= $verb eq "-h"C= $verb eq "help"D= not @a
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1757 | return ( "Register a runner to the server\n\nUsage:\n forgejo-runner register [flags]\n\nFlags:\n -h, --help help for register\n --instance string Forgejo instance address\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1758 | . " --labels string Runner tags, comma separated\n --name string Runner name\n --no-interactive Disable interactive mode\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1759 | 3 | ▶ | . " --token string Runner token\n\nGlobal Flags:\n -c, --config string config file path", 1 ) if $verb eq 'register' && grep { $_ eq '--help' || $_ eq '-h' } @a or $verb eq 'help' && ( $a[0] // '' ) eq 'register'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition28%4/14
$verb eq "register" and grep {$_ eq "--help" or $_ eq "-h";} @a or $verb eq "help" and ($a[0] // "") eq "register"
$verb eq "register" and grep {$_ eq "--help" or $_ eq "-h";} @a
$_ eq '--help' || $_ eq '-h'
$verb eq "help" and ($a[0] // "") eq "register"
$a[0] // ""
MC/DC0%0/4
$verb eq "register" and grep {$_ eq "--help" or $_ eq "-h";} @a or $verb eq "help" and ($a[0] // "") eq "register"
$verb eq "register"
grep {$_ eq "--help" or $_ eq "-h";} @a
$verb eq "help"
$a[0]
MC/DC0%0/2
$_ eq '--help' || $_ eq '-h'
$_ eq '--help'
$_ eq '-h'
Truth table14%1/7
A and B or C and D
A= $verb eq "register"B= grep {$_ eq "--help" or $_ eq "-h";} @aC= $verb eq "help"D= $a[0]
Truth table33%1/3
A || B
A= $_ eq '--help'B= $_ eq '-h'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1760 | 3 | ▶ | return ( 'forgejo-runner version v3.5.1', 1 ) if $verb eq '--version' || $verb eq '-v' || $verb eq 'version'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$verb eq "--version" or $verb eq "-v" or $verb eq "version"
$verb eq "--version" or $verb eq "-v"
MC/DC0%0/3
$verb eq "--version" or $verb eq "-v" or $verb eq "version"
$verb eq "--version"
$verb eq "-v"
$verb eq "version"
Truth table25%1/4
A or B or C
A= $verb eq "--version"B= $verb eq "-v"C= $verb eq "version"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1761 | 3 | ▶ | if ( $verb eq 'generate-config' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1762 | 0 | return ( "log:\n level: info\nrunner:\n file: .runner\n capacity: 1\n timeout: 3h\n labels: []\ncache:\n enabled: true\ncontainer:\n network: \"\"\n privileged: false\n docker_host: \"\"", 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1763 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1764 | 0 | ▶ | unless ( $verb eq 'register' ) { push @GAPS, "forgejo-runner $verb"; return ( '', 0 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1765 | 3 | my %o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1766 | 3 | ▶ | while (@a) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1767 | 13 | my $x = shift @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1768 | 0 | ▶ | if ( $x =~ /\A--(instance|token|name|labels)=(.*)\z/ ) { $o{$1} = $2 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1769 | 10 | elsif ( $x =~ /\A--(instance|token|name|labels)\z/ ) { $o{$1} = shift @a } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1770 | 3 | elsif ( $x eq '--no-interactive' ) { $o{ni} = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1771 | 0 | ▶ | elsif ( $x eq '-c' || $x eq '--config' ) { $o{config} = shift @a } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$x eq "-c" or $x eq "--config"
MC/DC0%0/2
$x eq "-c" or $x eq "--config"
$x eq "-c"
$x eq "--config"
Truth table0%0/3
A or B
A= $x eq "-c"B= $x eq "--config"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1772 | 0 | else { return ( "Error: unknown flag: $x", 0 ) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1773 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1774 | 0 | ▶ | unless ( $o{ni} ) { push @GAPS, 'forgejo-runner register (interaktiv)'; return ( 'Error opening terminal: unknown.', 0 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1775 | 3 | ▶ | return ( 'level=error msg="instance address is empty"', 0 ) unless length( $o{instance} // '' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$o{"instance"} // ""
MC/DC0%0/1
$o{"instance"} // ""
$o{"instance"}
Truth table50%1/2
A
A= $o{"instance"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1776 | 3 | ▶ | return ( 'level=error msg="token is empty"', 0 ) unless length( $o{token} // '' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$o{"token"} // ""
MC/DC0%0/1
$o{"token"} // ""
$o{"token"}
Truth table50%1/2
A
A= $o{"token"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1777 | 3 | ( my $want = $o{instance} ) =~ s{/+\z}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1778 | 3 | my ($host) = $want =~ m{\Ahttps?://([^/:]+)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1779 | 3 | ▶ | my ($srv) = grep { ( ( ( $ctx->{state}{$_} || {} )->{forgejo} || {} )->{root_url} // "\0" ) =~ m{\A\Q$want\E/?\z} } sort keys %{ $ctx->{state} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition75%6/8
(($$ctx{"state"}{$_} || {})->{"forgejo"} || {})->{"root_url"} // "\0"
($$ctx{'state'}{$_} || {})->{'forgejo'} || {}
$$ctx{'state'}{$_} || {}
$$ctx{'state'} || {}
MC/DC0%0/1
(($$ctx{"state"}{$_} || {})->{"forgejo"} || {})->{"root_url"} // "\0"
$$ctx{'state'}{$_}
MC/DC0%0/1
$$ctx{'state'} || {}
$$ctx{'state'}
Truth table50%1/2
A
A= $$ctx{'state'}{$_}
Truth table50%1/2
A
A= $$ctx{'state'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1780 | 3 | ▶ | return ( qq{level=error msg="Cannot ping the Forgejo instance server" error="unavailable: dial tcp: lookup } . ( $host // $want ) . ' on 127.0.0.53:53: no such host"', 0 ) unless defined $srv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$host // $want
MC/DC0%0/2
$host // $want
$host
$want
Truth table0%0/3
A // B
A= $hostB= $want
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1781 | 3 | my $fj = $ctx->{state}{$srv}{forgejo}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1782 | return ( 'level=info msg="Registering runner, name=' . ( $o{name} // '' ) . ", instance=$o{instance}, labels=[" . ( $o{labels} // '' ) . "].\"\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1783 | . 'level=fatal msg="Failed to register runner" error="unauthenticated: runner registration token not found"', 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1784 | 3 | ▶ | unless grep { $_ eq $o{token} } @{ $fj->{runner_tokens} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$$fj{'runner_tokens'} || []
$o{"name"} // ""
$o{"labels"} // ""
MC/DC0%0/1
$$fj{'runner_tokens'} || []
$$fj{'runner_tokens'}
MC/DC0%0/1
$o{"name"} // ""
$o{"name"}
MC/DC0%0/1
$o{"labels"} // ""
$o{"labels"}
Truth table50%1/2
A
A= $$fj{'runner_tokens'}
Truth table50%1/2
A
A= $o{"name"}
Truth table50%1/2
A
A= $o{"labels"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1785 | 2 | ▶ | my $name = $o{name} // $dev->{hostname} // 'runner'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
($o{"name"} // $$dev{"hostname"}) // "runner"
$o{"name"} // $$dev{"hostname"}
MC/DC0%0/2
($o{"name"} // $$dev{"hostname"}) // "runner"
$o{"name"}
$$dev{"hostname"}
Truth table33%1/3
A // B
A= $o{"name"}B= $$dev{"hostname"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1786 | 2 | ▶ | my @labels = grep {length} split /\s*,\s*/, $o{labels} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$o{"labels"} // ""
MC/DC100%1/1
$o{"labels"} // ""
$o{"labels"}
Truth table100%2/2
A
A= $o{"labels"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1787 | 2 | ▶ | my $id = 1 + scalar keys %{ $fj->{runners} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$$fj{'runners'} || {}
MC/DC100%1/1
$$fj{'runners'} || {}
$$fj{'runners'}
Truth table100%2/2
A
A= $$fj{'runners'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1788 | 2 | $fj->{runners}{$name} = { id => $id, labels => \@labels }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1789 | 2 | my $uuid = join '-', unpack 'A8 A4 A4 A4 A12', Digest::SHA::sha1_hex( "$srv/$name/$id" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1790 | 2 | ▶ | my $file = ( $cwd // ( ( $user // 'root' ) eq 'root' ? '/root' : ( ( ( $dev->{users} || {} )->{$user} || {} )->{home} // "/home/$user" ) ) ) . '/.runner'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition10%1/10
$cwd // (($user // "root") eq "root" ? "/root" : (($$dev{"users"} || {})->{$user} || {})->{"home"} // "/home/$user")
$user // "root"
(($$dev{"users"} || {})->{$user} || {})->{"home"} // "/home/$user"
($$dev{'users'} || {})->{$user} || {}
$$dev{'users'} || {}
MC/DC0%0/1
$cwd // (($user // "root") eq "root" ? "/root" : (($$dev{"users"} || {})->{$user} || {})->{"home"} // "/home/$user")
$cwd
MC/DC0%0/1
(($$dev{"users"} || {})->{$user} || {})->{"home"} // "/home/$user"
$$dev{'users'}
Truth table50%1/2
A
A= $cwd
Truth table0%0/2
A
A= $$dev{'users'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1791 | $dev->{files}{$file} = { content => JSON::MaybeXS->new( canonical => 1, pretty => 1 )->encode( { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1792 | WARNING => 'This file is automatically generated by act-runner. Do not edit it manually unless you know what you are doing. Removing this file will cause act runner to re-register as a new runner.', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1793 | 2 | ▶ | id => $id, uuid => $uuid, name => $name, token => substr( Digest::SHA::sha1_hex("token/$uuid"), 0, 40 ), address => $o{instance}, labels => \@labels } ) =~ s{" : }{": }gr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%4/4
$user // "root"
$user // "root"
MC/DC100%1/1
$user // "root"
$user
MC/DC100%1/1
$user // "root"
$user
Truth table100%2/2
A
A= $user
Truth table100%2/2
A
A= $user
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1794 | owner => $user // 'root', group => $user // 'root', mode => '0600' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1795 | 2 | return ( 'level=info msg="Registering runner, name=' . $name . ", instance=$o{instance}, labels=[" . join( ' ', @labels ) . "].\"\n" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1796 | . 'level=debug msg="Successfully pinged the Forgejo instance server"' . "\n" . 'level=info msg="Runner registered successfully."', 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1797 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1798 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1799 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1800 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1801 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||