3 class Gitalist::Git::Util {
6 use MooseX::Types::Common::String qw/NonEmptySimpleStr/;
8 isa => 'Gitalist::Git::Project',
9 handles => { gitdir => 'project_dir' },
10 is => 'bare', # No accessor
11 weak_ref => 1, # Weak, you have to hold onto me.
13 has _git => ( isa => NonEmptySimpleStr, is => 'ro', lazy_build => 1 );
15 my $git = File::Which::which('git');
19 Could not find a git executable.
20 Please specify the which git executable to use in gitweb.yml
28 isa => 'Git::PurePerl', is => 'ro', lazy => 1,
29 default => sub { Git::PurePerl->new(gitdir => shift->gitdir) },
32 method run_cmd (@args) {
33 unshift @args, ( '--git-dir' => $self->gitdir );
34 print STDERR 'RUNNING: ', $self->_git, qq[ @args], $/;
36 open my $fh, '-|', $self->_git, @args
37 or die "failed to run git command";
38 binmode $fh, ':encoding(UTF-8)';
40 my $output = do { local $/ = undef; <$fh> };