|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
  
 
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package Git::PurePerl::Pack::WithIndex;  | 
| 
2
 | 
4
 | 
 
 | 
 
 | 
  
4
  
 | 
 
 | 
15
 | 
 use Moose;  | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6
 | 
    | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
21
 | 
    | 
| 
3
 | 
4
 | 
 
 | 
 
 | 
  
4
  
 | 
 
 | 
15543
 | 
 use MooseX::StrictConstructor;  | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
    | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
22
 | 
    | 
| 
4
 | 
4
 | 
 
 | 
 
 | 
  
4
  
 | 
 
 | 
7508
 | 
 use namespace::autoclean;  | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6
 | 
    | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
27
 | 
    | 
| 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 extends 'Git::PurePerl::Pack';  | 
| 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 has 'index_filename' =>  | 
| 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     ( is => 'rw', isa => 'Path::Class::File', required => 0, coerce => 1 );  | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 has 'index' =>  | 
| 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     ( is => 'rw', isa => 'Git::PurePerl::PackIndex', required => 0 );  | 
| 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub BUILD {  | 
| 
14
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
  
0
  
 | 
6
 | 
     my $self = shift;  | 
| 
15
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
88
 | 
     my $index_filename = $self->filename;  | 
| 
16
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
9
 | 
     $index_filename =~ s/\.pack/.idx/;  | 
| 
17
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
210
 | 
     $self->index_filename($index_filename);  | 
| 
18
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
19
 | 
3
 | 
 
 | 
  
 33
  
 | 
 
 | 
 
 | 
15
 | 
     my $index_fh = IO::File->new($index_filename) || confess($!);  | 
| 
20
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
155
 | 
     $index_fh->binmode();  | 
| 
21
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
28
 | 
     $index_fh->read( my $signature, 4 );  | 
| 
22
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
36
 | 
     $index_fh->read( my $version,   4 );  | 
| 
23
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
18
 | 
     $version = unpack( 'N', $version );  | 
| 
24
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
     $index_fh->close;  | 
| 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
26
 | 
3
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
28
 | 
     if ( $signature eq "\377tOc" ) {  | 
| 
27
 | 
1
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
7
 | 
         if ( $version == 2 ) {  | 
| 
28
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
41
 | 
             $self->index(  | 
| 
29
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                 Git::PurePerl::PackIndex::Version2->new(  | 
| 
30
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                     filename => $index_filename  | 
| 
31
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                 )  | 
| 
32
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             );  | 
| 
33
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         } else {  | 
| 
34
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
             confess("Unknown version");  | 
| 
35
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
36
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     } else {  | 
| 
37
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
84
 | 
         $self->index(  | 
| 
38
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             Git::PurePerl::PackIndex::Version1->new(  | 
| 
39
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                 filename => $index_filename  | 
| 
40
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             )  | 
| 
41
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         );  | 
| 
42
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
44
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
45
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub get_object {  | 
| 
46
 | 
2338
 | 
 
 | 
 
 | 
  
2338
  
 | 
  
0
  
 | 
2382
 | 
     my ( $self, $want_sha1 ) = @_;  | 
| 
47
 | 
2338
 | 
 
 | 
 
 | 
 
 | 
 
 | 
58925
 | 
     my $offset = $self->index->get_object_offset($want_sha1);  | 
| 
48
 | 
2338
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
3157
 | 
     return unless $offset;  | 
| 
49
 | 
2338
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5562
 | 
     return $self->unpack_object($offset);  | 
| 
50
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
51
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
52
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 __PACKAGE__->meta->make_immutable;  | 
| 
53
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    |