NAME

Gitalist::Git::Repository - Model of a git repository

SYNOPSIS

my $gitrepo = dir('/repo/base/Gitalist');
my $repository = Gitalist::Git::Repository->new($gitrepo);
 $repository->name;        # 'Gitalist'
 $repository->path;        # '/repo/base/Gitalist/.git'
 $repository->description; # 'Unnamed repository.'

DESCRIPTION

This class models a git repository, referred to in Gitalist as a "Repository".

ATTRIBUTES

name

The name of the Repository. If unspecified, this will be derived from the path to the git repository.

path

Path::Class:Dir for the filesystem path to the git repository.

description

The contents of .git/description.

owner

Owner of the files on the filesystem.

last_change

The DateTime of the last modification of the repository. This will be undef if the repository has never been used.

is_bare

True if this is a bare git repository.

heads

tags

An array of the name and sha1 of all heads/tags in the repository.

references

Hashref of ArrayRefs for each reference.

METHODS

head_hash ($head?)

Return the sha1 for HEAD, or any specified head.

list_tree ($sha1?)

Return an array of contents for a given tree. The tree is specified by sha1, and defaults to HEAD. Each item is a Gitalist::Git::Object.

get_object ($sha1)

Return an appropriate subclass of Gitalist::Git::Object for the given sha1.

hash_by_path ($sha1, $path, $type?)

Returns the sha1 for a given path, optionally limited by type.

list_revs ($sha1, $count?, $skip?, \%search?, $file?)

Returns a list of revs for the given head ($sha1).

snapshot ($sha1, $format)

Generate an archived snapshot of the repository. $sha1 should be a commit or tree. Returns a filehandle to read from.

diff ($commit, $patch?, $parent?, $file?)

Generate a diff from a given Gitalist::Git::Object.

reflog (@lorgargs)

Return a list of hashes representing each reflog entry.

FIXME Should this return objects?

SEE ALSO

Gitalist::Git::Util Gitalist::Git::Object

AUTHORS

See Gitalist for authors.

LICENSE

See Gitalist for the license.