NAME

Git::Database - Provide access to the Git object database

VERSION

version 0.012

SYNOPSIS

# get a store
my $r  = Git::Repository->new();

# build a backend to access the store
my $db = Git::Database::Backend::Git::Repository->new( store => $r );

# or let Git::Database figure it out by itself
my $db = Git::Database->new( store => $r );

# or let Git::Database assemble the store from its parts
my $db = Git::Database->new(
    backend   => 'Git::Repository',
    work_tree => $work_tree,
);

my $db = Git::Database->new(
    backend => 'Git::Repository',
    git_dir => $git_dir,
);

# work in the current directory
my $db = Git::Database->new( backend => 'Git::Repository' );

# pick the best available backend
my $db = Git::Database->new;

DESCRIPTION

Git::Database provides access from Perl to the object database stored in a Git repository. It can use any supported Git wrapper to access the Git object database maintained by Git.

Git::Database is actually a factory class: "new" returns backend instances.

Check Git::Database::Tutorial for details.

METHODS

new

my $r = Git::Repository->new;

# $db is-a Git::Database::Backend::Git::Repository
my $db = Git::Database->new( store => $r );

Return a backend object, based on the parameters passed to new().

If the store parameter is given, all other paramaters are ignored, and the returned backend is of the class corresponding to the store object.

If the store parameter is missing, the backend class is selected according to the backend parameter, or picked automatically among the available store classes (picking the fastest and more feature-complete among them). The actual store object is then instantiated using the work_tree and git_dir optional parameters. If none is given, the repository is assumed to be in the current directory.

available_stores

say for Git::Database->available_stores;

This class methods returns the list of store classes that are available (i.e. installed with a version matching the minimum version requirements).

BACKEND METHODS

The backend methods are split between several roles, and not all backends do all the roles. Therefore not all backend objects support all the following methods.

From Git::Database::Role::Backend

This is the minimum required role to be a backend. Hence this method is always available.

hash_object

From Git::Database::Role::ObjectReader

has_object
get_object_meta
get_object_attributes
get_object
all_digests

From Git::Database::Role::ObjectWriter

put_object

From Git::Database::Role::RefReader

refs
ref_names
ref_digest

From Git::Database::Role::RefWriter

put_ref
delete_ref

SEE ALSO

Objects

Git::Database::Object::Blob, Git::Database::Object::Tree, Git::Database::Object::Commit, Git::Database::Object::Tag.

Backend roles

Git::Database::Role::Backend, Git::Database::Role::ObjectReader, Git::Database::Role::ObjectWriter, Git::Database::Role::RefReader, Git::Database::Role::RefWriter.

Backends

Git::Database::Backend::None, Git::Database::Backend::Git::Repository, Git::Database::Backend::Git::Sub, Git::Database::Backend::Git::PurePerl, Git::Database::Backend::Cogit, Git::Database::Backend::Git, Git::Database::Backend::Git::Wrapper, Git::Database::Backend::Git::Raw.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Git::Database

You can also look for information at:

AUTHOR

Philippe Bruhat (BooK) <book@cpan.org>.

COPYRIGHT

Copyright 2013-2019 Philippe Bruhat (BooK), all rights reserved.

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.