3 class Gitalist::Git::Util {
6 use MooseX::Types::Common::String qw/NonEmptySimpleStr/;
7 has gitdir => ( isa => 'Path::Class::Dir', is => 'ro', required => 1 );
8 has _git => ( isa => NonEmptySimpleStr, is => 'ro', lazy_build => 1 );
10 my $git = File::Which::which('git');
14 Could not find a git executable.
15 Please specify the which git executable to use in gitweb.yml
22 has _gpp => ( isa => 'Git::PurePerl', is => 'rw', lazy_build => 1 );
24 my $gpp = Git::PurePerl->new(gitdir => $self->gitdir);
28 method run_cmd (@args) {
29 unshift @args, ( '--git-dir' => $self->gitdir );
30 print STDERR 'RUNNING: ', $self->_git, qq[ @args], $/;
32 open my $fh, '-|', $self->_git, @args
33 or die "failed to run git command";
34 binmode $fh, ':encoding(UTF-8)';
36 my $output = do { local $/ = undef; <$fh> };