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;
}
## Public methods
+
+ multi method get_object_or_head (SHA1 $sha1) {
+ $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;
chomp($type);
my $class = 'Gitalist::Git::Object::' . ucfirst($type);
$class->new(
- project => $self,
+ repository => $self,
sha1 => $sha1,
type => $type,
);
method diff ( Gitalist::Git::Object :$commit!,
Bool :$patch?,
Maybe[NonEmptySimpleStr] :$parent?,
- NonEmptySimpleStr :$file?
+ NonEmptySimpleStr :$filename?
) {
return $commit->diff( patch => $patch,
parent => $parent,
- file => $file);
+ filename => $filename);
}
method reflog (@logargs) {
## BUILDERS
method _build_util {
Gitalist::Git::Util->new(
- project => $self,
+ repository => $self,
);
}
$description = $self->path->file('description')->slurp;
chomp $description;
};
+ $description = "Unnamed repository, edit the .git/description file to set a description"
+ if $description eq "Unnamed repository; edit this file 'description' to name the repository.";
return $description;
}
=head1 SYNOPSIS
my $gitrepo = dir('/repo/base/Gitalist');
- my $project = Gitalist::Git::Repository->new($gitrepo);
- $project->name; # 'Gitalist'
- $project->path; # '/repo/base/Gitalist/.git'
- $project->description; # 'Unnamed repository.'
+ my $repository = Gitalist::Git::Repository->new($gitrepo);
+ $repository->name; # 'Gitalist'
+ $repository->path; # '/repo/base/Gitalist/.git'
+ $repository->description; # 'Unnamed repository.'
=head1 DESCRIPTION
This class models a git repository, referred to in Gitalist
-as a "Project".
+as a "Repository".
=head1 ATTRIBUTES
=head2 name
-The name of the Project. If unspecified, this will be derived from the path to the git repository.
+The name of the Repository. If unspecified, this will be derived from the path to the git repository.
=head2 path