Git::Raw::Index(3pm)
π Git::Raw::Index β the vibe guide π
okay bestie, so this is Git::Raw::Index, a Perl module from the User Contributed Perl Documentation corner of the internet, and it is literally the class that represents a Git index in a Git repo. yes THAT index. the staging area. the thing you're always git add-ing into. she's iconic and she runs the whole show. β¨
version 0.90 btw, for the record.
πΈ NAME πΈ
Git::Raw::Index β the Git index class. that's her. that's the girl. π
β¨ VERSION β¨
version 0.90
π¦ DESCRIPTION π¦
so a Git::Raw::Index represents an index in a Git repository. simple as that, no cap.
β οΈ WARNING: bestie listen to me. The API of this module is unstable and may change without warning. any change will be appropriately documented in the changelog, but like β heads up. it's giving living document. π«
π METHODS π
π new( )
Create a new in-memory index.
ngl, this is currently of little use. she exists, she's there, she's cute, but she's not doing much. main character with no plot yet. π
π owner( )
Retrieve the Git::Raw::Repository owning the index. like, who's your repo bestie. π«Ά
π add( $entry )
Add $entry to the index. $entry should either be the path of a file, or alternatively a Git::Raw::Index::Entry. either works, we're flexible. β¨
π add_frombuffer( $path, $buffer, [$mode] )
Add or update an entry from an in-memory file. the entry gets placed at $path with the contents of $buffer. $buffer may either be a string or a reference to a string (both slay). $mode is the file mode and it defaults to 0100644. Returns a Git::Raw::Index::Entry object. π
π add_all( \%opts )
Add or update all index entries to match the working directory. she's doing the most, and we love her for it. valid fields for the %opts hash are:
pathsβ List of path patterns to add.flagsβ Valid fields for the%flagsmember:forceβ Forced addition of files (even if they are ignored). she does not care about your.gitignore. π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$pathand matching$pathspec. This callback should return0if the file should be added to the index,>0if it should be skipped, or<0to abort. yes, your callback has OPINIONS and they get respected. π£οΈ
π find( $path )
Find the first Git::Raw::Index::Entry which points to a given $path. if an entry cannot be found, this function will return undef. she looked everywhere, she's not there, moving on. π
π remove( $path )
Remove $path from the index. bye bestie. π
π remove_all( \%opts )
Remove all matching index entries. see "Git::Raw::Index->update_all()" for valid %opts values. (yes it points you at the update one, that's not a typo, that's just how she is.)
π path( )
Retrieve the full path to the index file on disk.
π checksum( )
Retrieve the SHA-1 checksum over the index file, except for the last 20 bytes which is the checksum content itself. if the index does not exist on-disk, an empty OID will be returned. no file, no checksum, we stay unbothered. π§
π clear( )
Clear the index. wipe her clean, fresh start, new era. π§Ό
π read( [$force] )
Update the index, reading it from disk.
π write( )
Write the index to disk. manifesting it into existence. β¨
π read_tree( $tree )
Replace the index content 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. Returns a Git::Raw::Tree object. π³
π 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.
π entry_count( )
Retrieve the number of entries in the index. math girlie moment. π’
π entries( )
Retrieve index entries. Returns a list of Git::Raw::Index::Entry objects.
π add_conflict( $ancestor, $theirs, $ours)
Add a new conflict entry. $ancestor, $theirs and $ours should be Git::Raw::Index::Entry objects. drama? in MY index? more likely than you think. π₯
π get_conflict( $path )
Get the conflict entry for $path. if $path has no conflict entry, this function will return undef. (no beef here, bestie.)
π remove_conflict( $path )
Remove $path from the index.
π has_conflicts( )
Determine if the index contains entries representing file conflicts. vibe check: is there beef? π₯
π conflict_cleanup( )
Remove all conflicts in the index (entries with a stage greater than 0). healing era fr fr. ποΈ
π conflicts( )
Retrieve index entries that represent a conflict. Returns a list of Git::Raw::Index::Conflict objects.
π merge( $ancestor, $theirs, $ours, [\%merge_opts] )
Merge two files as they exist in the index. $ancestor, $theirs and $ours should be Git::Raw::Index::Entry objects. Returns a Git::Raw::Merge::File::Result object. valid fields for the %merge_opts hash are:
our_labelβ The name of the "our" side of conflicts.their_labelβ The name of the "their" side of conflicts.ancestor_labelβ The name of the common ancestor side of conflicts.favorβ Specify content automerging behaviour. Valid values areours,theirs, andunion. pick a side, pick a side. πmarker_sizeβ The size of conflict markers.flagsβ Merge file flags. Valid values include:mergeβ Create standard conflicted merge file.diff3β Create diff3-style files.simplify_alnumβ Condense non-alphanumeric regions for simplified diff file.ignore_whitespaceβ Ignore all whitespace.ignore_whitespace_changeβ Ignore changes in amount of whitespace.ignore_whitespace_eolβ Ignore whitespace at end of line.patienceβ Use the"patience diff"algorithm.minimalβ Take extra time to find minimal diff. she's thorough and she is NOT rushing. π
π 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$pathand matching$pathspec. This callback should return0if the file should be added to the index,>0if it should be skipped, or<0to abort. same callback energy, different method, we stan consistency. π«Ά
π 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. she's telling you what she can do. believe her. β¨
π version( [$version] )
Retrieve or set the index version. get it, set it, she's both things at once. dual threat. π₯
π AUTHOR π
Alessandro Ghedini <alexbio@cpan.org>
Jacques Germishuys <jacquesg@cpan.org>
π 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.
okay bestie that's the whole page, we ate and left no crumbs π
this absolute icon of a document was served up by perl v5.42.3 on 2026-08-19, and the page itself is Git::Raw::Index(3pm). go forth and stage things responsibly. ππ¦π
π¦ where this page comes from
- ubuntu stonking: libgit-raw-perl 0.90+ds-3build3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms