The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Git::Raw::Index - Git index class

VERSION

version 0.44

DESCRIPTION

A Git::Raw::Index represents an index in a Git repository.

WARNING: The API of this module is unstable and may change without warning (any change will be appropriately documented in the changelog).

METHODS

owner( )

Retrieve the Git::Raw::Repository owning the index.

add( $entry )

Add $entry to the index. $entry should either be the path of a file or alternatively a Git::Raw::Index::Entry.

add_all( \%opts )

Add or update all index entries to match the working directory. Valid fields for the %opts hash are:

  • "paths"

    List of path patterns to add.

  • "flags"

    Valid fields for the %flags member:

    • "force"

      Forced addition of files (even if they are ignored).

    • "disable_pathspec_match"

      Disable pathspec pattern matching against entries in $paths.

    • "check_pathspec"

      Enable pathspec pattern matching against entries in $paths (default).

  • "notification"

    The callback to be called for each added or updated item. Receives the $path and matching $pathspec. This callback should return 0 if the file should be added to the index, >0 if it should be skipped or <0 to abort.

find( $path )

Find the first Git::Raw::Index::Entry which point to given $path. If an entry cannot be found, this function will return undef.

remove( $path )

Remove $path from the index.

remove_all( \%opts )

Remove all matching index entries. See Git::Raw::Index->update_all() for valid %opts values.

path( )

Retrieve the full path to the index file on disk.

clear( )

Clear the index.

read( [$force] )

Update the index reading it from disk.

write( )

Write the index to disk.

read_tree( $tree )

Replace the index contente with $tree.

write_tree( [$repo] )

Create a new tree from the index and write it to disk. $repo optionally indicates which Git::Raw::Repository the tree should be written to.

checkout( [\%checkout_opts] )

Update files in the working tree to match the contents of the index. See Git::Raw::Repository->checkout() for valid %checkout_opts values.

entries( )

Retrieve index entries. Returns a list of Git::Raw::Index::Entry objects.

remove_conflict( $file )

Remove $file from the index.

has_conflicts( )

Determine if the index contains entries representing file conflicts.

conflict_cleanup( )

Remove all conflicts in the index (entries with a stage greater than 0).

conflicts( )

Retrieve index entries that represent a conflict. Returns a list of Git::Raw::Index::Entry objects.

update_all( \%opts )

Update all index entries to match the working directory. Valid fields for the %opts hash are:

  • "paths"

    List of path patterns to add.

  • "notification"

    The callback to be called for each updated item. Receives the $path and matching $pathspec. This callback should return 0 if the file should be added to the index, >0 if it should be skipped or <0 to abort.

capabilities( )

Retrieve the index's capabilities. Returns a hash with members "ignore_case", "no_filemode" and "no_symlinks", each indicating if the Git::Raw::Index supports the capability.

AUTHOR

Alessandro Ghedini <alexbio@cpan.org>

Jacques Germishuys <jacquesg@striata.com>

LICENSE AND COPYRIGHT

Copyright 2012 Alessandro Ghedini.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.