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} |!);
37 $::lxdebug->message(LXDebug::WARN(), "Error spawning git: $!");
41 my @log = grep { $_ } map { $self->_parse_log_line($_) } <$in>;
48 my ($self, $line) = @_;
52 my @fields = split m/\|/, $line, 5;
53 return undef unless scalar(@fields) == 5;
57 author_name => $fields[1],
58 author_email => $fields[2],
59 subject => $fields[4],
62 if ($fields[3] =~ m/^(\d+)-(\d+)-(\d+)\s+(\d+):(\d+):(\d+)\s+?([\+\-]?\d+)?$/) {
63 $commit{author_date} = DateTime->new(year => $1, month => $2, day => $3, hour => $4, minute => $5, second => $6, time_zone => $7);