use MooseX::Types::Path::Class qw/Dir/;
use MooseX::Types::Moose qw/Str Maybe Bool HashRef ArrayRef/;
use Gitalist::Git::Types qw/SHA1/;
- use MooseX::MultiMethods;
use Moose::Autobox;
use List::MoreUtils qw/any zip/;
use DateTime;
is => 'ro',
lazy => 1,
default => sub {
- -d $_[0]->path->parent->subdir->($_[0]->name)
+ -d $_[0]->path->parent->subdir($_[0]->name)
? 1 : 0
},
);
lazy_build => 1 );
method BUILD {
- $self->$_() for qw/last_change owner description/; # Ensure to build early.
+ $self->$_() for qw/last_change owner description /; # Ensure to build early.
}
## Public methods
- multi method get_object_or_head (SHA1 $sha1) {
+ method get_object_or_head (NonEmptySimpleStr $ref) {
+ my $sha1 = is_SHA1($ref) ? $ref : $self->head_hash($ref);
$self->get_object($sha1);
}
- multi method get_object_or_head (NonEmptySimpleStr $ref) {
- my $sha1 = $self->head_hash($ref);
- $self->get_object($sha1);
- }
-
+
method head_hash (Str $head?) {
my $output = $self->run_cmd(qw/rev-parse --verify/, $head || 'HEAD' );
confess("No such head: " . $head) unless defined $output;
# TODO - support compressed archives
}
- method diff ( Gitalist::Git::Object :$commit!,
- Bool :$patch?,
- Maybe[NonEmptySimpleStr] :$parent?,
- NonEmptySimpleStr :$filename?
- ) {
- return $commit->diff( patch => $patch,
- parent => $parent,
- filename => $filename);
- }
-
method reflog (@logargs) {
my @entries
= $self->run_cmd(qw(log -g), @logargs)