NAME
Git::Wrapper - wrap git(7) command-line interface
VERSION
Version 0.005
SYNOPSIS
my $git = Git::Wrapper->new('/var/foo');
$git->commit(...)
print $_->message for $git->log;
DESCRIPTION
Git::Wrapper provides an API for git(7) that uses Perl data structures for argument passing, instead of CLI-style --options
as Git does.
METHODS
Except as documented, every git subcommand is available as a method on a Git::Wrapper object.
The first argument should be a hashref containing options and their values. Boolean options are either true (included) or false (excluded). The remaining arguments are passed as ordinary command arguments.
$git->commit({ all => 1, message => "stuff" });
$git->checkout("mybranch");
Output is available as an array of lines, each chomped.
@sha1s_and_titles = $git->rev_list({ all => 1, pretty => 'oneline' });
If a git command exits nonzero, a Git::Wrapper::Exception
object will be thrown. It has three useful methods:
error
error message
output
normal output, as a single string
status
the exit status
The exception stringifies to the error message.
new
my $git = Git::Wrapper->new($dir);
dir
print $git->dir; # /var/foo
version
my $version = $git->version; # 1.6.1.4.8.15.16.23.42
log
my @logs = $git->log;
Instead of giving back an arrayref of lines, the log
method returns a list of Git::Wrapper::Log
objects. They have four methods:
id
author
date
message
SEE ALSO
VCI::VCS::Git is the git implementation for VCI, a generic interface to version-controle systems.
Git itself is at http://git.or.cz.
AUTHOR
Hans Dieter Pearcey, <hdp@cpan.org>
BUGS
Please report any bugs or feature requests to bug-git-wrapper@rt.cpan.org
, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
COPYRIGHT & LICENSE
Copyright 2008 Hans Dieter Pearcey, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.