6 use parent qw(Rose::Object);
9 use List::Util qw(first);
11 sub is_git_installation {
14 return $self->git_exe && -d ".git" && -f ".git/config" ? 1 : 0;
20 return $self->{git_exe} if $self->{_git_exe_search};
22 $self->{_git_exe_search} = 1;
23 $self->{git_exe} = first { -x } map { "${_}/git" } split m/:/, $ENV{PATH};
25 return $self->{git_exe};
29 my ($self, %params) = @_;
31 croak "No git executable found" if !$self->git_exe;
33 my $since_until = join '..', $params{since}, $params{until};
34 my $in = IO::File->new($self->git_exe . qq! log --format='tformat:\%H|\%an|\%ae|\%ai|\%s' ${since_until} |!);
38 $::lxdebug->message(LXDebug::WARN(), "Error spawning git: $!");
42 my @log = grep { $_ } map { $self->_parse_log_line($_) } <$in>;
49 my ($self, $line) = @_;
53 my @fields = split m/\|/, $line, 5;
54 return undef unless scalar(@fields) == 5;
58 author_name => $fields[1],
59 author_email => $fields[2],
60 subject => $fields[4],
63 if ($fields[3] =~ m/^(\d+)-(\d+)-(\d+)\s+(\d+):(\d+):(\d+)\s+?([\+\-]?\d+)?$/) {
64 $commit{author_date} = DateTime->new(year => $1, month => $2, day => $3, hour => $4, minute => $5, second => $6, time_zone => $7);