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