This file is indexed.

/usr/share/perl5/App/KGB/Commit.pm is in kgb-client 1.33-2ubuntu1.

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
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# vim: ts=4:sw=4:et:ai:sts=4
#
# KGB - an IRC bot helping collaboration
# Copyright © 2008 Martín Ferrari
# Copyright © 2009 Damyan Ivanov
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
package App::KGB::Commit;

use strict;
use warnings;

our $VERSION = 1.27;

=head1 NAME

App::KGB::Commit - a single commit

=head1 SYNOPSIS

    my $c = App::KGB::Commit->new(
        {   id      => 4536,
            changes => ["(M)/there"],
            log     => "fixed /there",
            author  => "My Self <mself@here.at>",
            branch  => "trunk",
            module  => "test",
        }
    );

=head1 DESCRIPTION

B<App::KGB::Change> encapsulates a single commit. A commit has several
properties: an ID, a list of changes, an author, a log message, optionally also
a branch and a module.

=head1 FIELDS

=over

=item B<id>

The commit ID that uniquely identifies it in the repository (if applicable).

=item B<changes>

An arrayref of L<App::KGB::Change> instances or other objects that behave as
strings.

=item B<author>

=item B<log>

=item B<branch>

=item B<module>

=back

=cut

use base 'Class::Accessor::Fast';
__PACKAGE__->mk_accessors( qw( id changes log author author_name branch module ) );

use Carp qw(confess);

=head1 CONSTRUCTOR

=head2 new ( { I<initial field values> } )

Standard constructor. Accepts a hashref with field values.

=cut

sub new {
    my $class = shift;
    my $self  = $class->SUPER::new(@_);

    not defined( $self->changes )
        or ref( $self->changes ) and ref( $self->changes ) eq 'ARRAY'
        or confess "'changes' must be an arrayref";

    my $log = $self->log;
    utf8::decode($log)
        or $log = "(log message is not valid UTF-8)"
        if defined($log);
    $self->log($log);

    return $self;
}

=head1 OVERLOADS

=over

=item stringify

Returns a text representation of the commit object

=back

=cut

use overload '""' => \&stringify;

sub stringify {
    my $self = shift;

    my @data;
    for my $f (qw(id changes log author author_name branch module)) {
        next unless $self->$f;

        if ( $f eq 'changes' ) {
            push @data, "changes=[" . join( ', ', @{ $self->$f } ) . "]";
        }
        else {
            push @data, "$f=" . $self->$f;
        }
    }

    return ref($self) . '(' . join( ', ', @data ) . ')';
}

1;