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 %flags member:
    • 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 $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. 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 are ours, theirs, and union. 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 $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. 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>


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