<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">NAME
    Git::Wrapper - wrap git(7) command-line interface

VERSION
    version 0.015

SYNOPSIS
      my $git = Git::Wrapper-&gt;new('/var/foo');

      $git-&gt;commit(...)
      print $_-&gt;message for $git-&gt;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. Replace any hyphens in the git command with
    underscores.

    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-&gt;commit({ all =&gt; 1, message =&gt; "stuff" });

      $git-&gt;checkout("mybranch");

    Output is available as an array of lines, each chomped.

      @sha1s_and_titles = $git-&gt;rev_list({ all =&gt; 1, pretty =&gt; '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-&gt;new($dir);

  dir
      print $git-&gt;dir; # /var/foo

  version
      my $version = $git-&gt;version; # 1.6.1.4.8.15.16.23.42

  log
      my @logs = $git-&gt;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

  status
      my $statuses = $git-&gt;status;

    This returns an instance of Git::Wrapper:Statuses which has two public
    methods. First, "is_dirty":

      my $dirty_flag = $statuses-&gt;is_dirty;

    Which returns a true/false value depending on whether the repository has
    any uncommitted changes.

    Second, "get":

      my @status = $statuses-&gt;get($group)

    Which returns an array of Git::Wrapper::Status objects, one per file
    changed.

    There are four status groups, each of which may contain zero or more
    changes.

    *   indexed : Changed &amp; added to the index (aka, will be committed)

    *   changed : Changed but not in the index (aka, won't be committed)

    *   unknown : Untracked files

    *   conflict : Merge conflicts

    Note that a single file can occur in more than one group. Eg, a modified
    file that has been added to the index will appear in the 'indexed' list.
    If it is subsequently further modified it will additionally appear in
    the 'changed' group.

    A Git::Wrapper::Status object has three methods you can call:

      my $from = $status-&gt;from;

    The file path of the changed file, relative to the repo root. For
    renames, this is the original path.

      my $to = $status-&gt;to;

    Renames returns the new path/name for the path. In all other cases
    returns an empty string.

      my $mode = $status-&gt;mode;

    Indicates what has changed about the file.

    Within each group (except 'conflict') a file can be in one of a number
    of modes, although some modes only occur in some groups (eg, 'added'
    never appears in the 'unknown' group).

    *   modified

    *   added

    *   deleted

    *   renamed

    *   copied

    *   conflict

    All files in the 'unknown' group will have a mode of 'unknown' (which is
    redundant but at least consistent).

    The 'conflict' group instead has the following modes.

    *   'both deleted' : deleted on both branches

    *   'both added' : added on both branches

    *   'both modified' : modified on both branches

    *   'added by us' : added only on our branch

    *   'deleted by us' : deleted only on our branch

    *   'added by them' : added on the branch we are merging in

    *   'deleted by them' : deleted on the branch we are merging in

    See git-status man page for more details.

   Example
        my $git = Git::Wrapper-&gt;new('/path/to/git/repo');
        my $statuses = $git-&gt;status;
        for my $type (qw&lt;indexed changed unknown conflict&gt;) {
            my @states = $statuses-&gt;get($type)
                or next;
            print "Files in state $type\n";
            for (@states) {
                print '  ', $_-&gt;mode, ' ', $_-&gt;from;
                print ' renamed to ', $_-&gt;to
                    if $_-&gt;mode eq 'renamed';
                print "\n";
            }
        }

COMPATIBILITY
    On Win32 Git::Wrapper is incompatible with msysGit installations earlier
    than Git-1.7.1-preview20100612 due to a bug involving the return value
    of a git command in cmd/git.cmd. If you use the msysGit version
    distributed with GitExtensions or an earlier version of msysGit, tests
    will fail during installation of this module. You can get the latest
    version of msysGit on the Google Code project page:
    &lt;http://code.google.com/p/msysgit/downloads&gt;

SEE ALSO
    VCI::VCS::Git is the git implementation for VCI, a generic interface to
    version-controle systems.

    Git itself is at &lt;http://git.or.cz&gt;.

BUGS
    Please report any bugs or feature requests to
    "bug-git-wrapper@rt.cpan.org", or through the web interface at
    &lt;http://rt.cpan.org&gt;. I will be notified, and then you'll automatically
    be notified of progress on your bug as I make changes.

AUTHORS
    *   Hans Dieter Pearcey &lt;hdp@cpan.org&gt;

    *   Chris Prather &lt;chris@prather.org&gt;

COPYRIGHT AND LICENSE
    This software is copyright (c) 2008 by Hans Dieter Pearcey.

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

</pre></body></html>