/usr/share/perl5/Git/PurePerl/Pack/WithIndex.pm is in libgit-pureperl-perl 0.50-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | package Git::PurePerl::Pack::WithIndex;
use Moose;
use MooseX::StrictConstructor;
use namespace::autoclean;
extends 'Git::PurePerl::Pack';
has 'index_filename' =>
( is => 'rw', isa => 'Path::Class::File', required => 0, coerce => 1 );
has 'index' =>
( is => 'rw', isa => 'Git::PurePerl::PackIndex', required => 0 );
sub BUILD {
my $self = shift;
my $index_filename = $self->filename;
$index_filename =~ s/\.pack/.idx/;
$self->index_filename($index_filename);
my $index_fh = IO::File->new($index_filename) || confess($!);
$index_fh->binmode();
$index_fh->read( my $signature, 4 );
$index_fh->read( my $version, 4 );
$version = unpack( 'N', $version );
$index_fh->close;
if ( $signature eq "\377tOc" ) {
if ( $version == 2 ) {
$self->index(
Git::PurePerl::PackIndex::Version2->new(
filename => $index_filename
)
);
} else {
confess("Unknown version");
}
} else {
$self->index(
Git::PurePerl::PackIndex::Version1->new(
filename => $index_filename
)
);
}
}
sub get_object {
my ( $self, $want_sha1 ) = @_;
my $offset = $self->index->get_object_offset($want_sha1);
return unless $offset;
return $self->unpack_object($offset);
}
__PACKAGE__->meta->make_immutable;
|