Git::Raw::Odb(3pm)

πŸ’– Git::Raw::Odb β€” the manual, but make it bestie πŸ’–

okay so you're looking at Git::Raw::Odb(3pm), which is the perl doc for the Git object database class, and honestly? it's a whole vibe. let's get into it 🫢


✨ VERSION ✨

version 0.90 β€” that's what we're working with, no cap πŸ‘‘


🌸 DESCRIPTION 🌸

A Git::Raw::Odb represents a git object database. that's it, that's the whole lore πŸŽ€

⚠️ WARNING: the API of this module is unstable and may change without warning. any change will be appropriately documented in the changelog, so like, don't get too attached bestie 😭

πŸ’… METHODS πŸ’…

πŸ¦‹ new( )

Create a new object database. fresh start, main character energy ✨

πŸ¦‹ open( $directory )

Create a new object database and automatically add the two default backends. $directory should be the path to the 'objects' directory πŸ“ β€” yes, that one, the objects one, don't get it twisted.

πŸ¦‹ backend_count( )

Get the number of ODB backend objects. counting. we love to see it πŸ”’

πŸ¦‹ refresh( )

Refresh the object database to load newly added files. if the object databases have changed on disk while the library is running, this function will force a reload of the underlying indexes. use this method when you're confident that an external application has tampered with the ODB πŸ‘€ β€” like, confident-confident. it's giving "i know something changed and i'm choosing to trust the filesystem."

πŸ¦‹ foreach( $repo, $callback )

Run $callback for every object available in the database. the callback receives a single argument β€” that's the OID of the object. a non-zero return value will terminate the loop πŸ›‘ so if you wanna bail early, just return something truthy. iykyk.

πŸ¦‹ add_backend( $backend, $priority )

Add a custom backend to the ODB. the backends are checked in relative ordering, based on the value of $priority. so like, priority is a ranking, bestie πŸ†

πŸ¦‹ add_alternate( $backend, $priority )

Add an alternate custom backend to the ODB. alternate backends are always checked for objects after all the main backends have been exhausted. also: writing is disabled on alternate backends 🚫✍️ β€” look, don't try it, read-only is read-only.

πŸ¦‹ read( $id )

Read an object from the database. returns a Git::Raw::Odb::Object, or "undef" if the object does not exist πŸ’€ (no object, no problem, you just get undef).

πŸ¦‹ write( $data, type )

Write an object directly to the database. returns the OID of the object. $type should be one of the values as defines in the constants section of Git::Raw::Object πŸ“ (yes, that's the original wording β€” the constants live over there, go look).

πŸ¦‹ hash( $data, $type )

Determine the object-ID (sha1 hash) of $data. $type should be one of the values as defined in the constants section of Git::Raw::Object πŸ” same energy, just hashing instead of writing.


πŸ‘‘ AUTHOR πŸ‘‘

Jacques Germishuys <jacquesg@cpan.org> β€” legend behavior, fr fr 🫢


Copyright 2016 Jacques Germishuys.

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 and that's the whole page πŸŽ€ this doc rode in on perl v5.42.3 and it's dated 2026-08-19 β€” so yeah, a lil time traveler, but she ate πŸ’… slay, go write some objects, bestie 🌈✨

πŸ“¦ where this page comes from