Expand description
Git objects: ids, kinds, in-memory representations, and the object database stack.
Canonical layout groups loose/packed storage, hashing, deltas, and reachability bitmaps under this module.
Library guide: mod
use grit_lib::repo::{InitOptions, Repository};
let dir = tempfile::tempdir()?;
let _repo = Repository::init(dir.path(), &InitOptions::default())?;
let _odb = _repo.odb();
Re-exports§
pub use handle::Objects;pub use crate::change_id::change_id;pub use crate::change_id::find_commits_by_change_id_prefix;pub use crate::change_id::is_change_id_spec_token;pub use crate::change_id::resolve_commit_by_change_id_prefix;pub use crate::change_id::resolved_change_id;pub use crate::change_id::set_change_id;pub use crate::change_id::ChangeId;pub use crate::change_id::ChangeIdError;pub use crate::change_id::ChangeIdGenerator;pub use crate::change_id::ChangeIdMatch;pub use crate::change_id::ChangeIdPolicy;pub use crate::change_id::OsChangeIdGenerator;pub use crate::change_id::ResolvedChangeId;
Modules§
- bench_
fixture - Synthetic repository fixtures for benchmarks and tests.
- bitmap
- Pack and commit reachability bitmaps.
- commit_
graph - Commit-graph files for reachability and generation numbers.
- delta_
encode - Delta compression encoding for pack streams.
- delta_
islands - Delta island boundaries for pack reuse.
- handle
- Repository-scoped object database access via
Objects. - hash
- Object-id hashing, file checksums, and hash algorithm selection.
- index_
pack - Index-pack and thin-pack handling.
- midx
- Multi-pack-index (MIDX) read and write.
- odb
- Object database backends and loose/packed storage.
- pack
- Pack files, indexes, and packfile I/O.
- pack_
name_ hash - Name-hash tables for delta base selection.
- pack_
object_ select - Object selection heuristics for packing.
- pack_
objects - Pack-objects negotiation and encoding.
- pack_
receive - Receive-pack side pack ingestion.
- pack_
reuse - Verbatim pack reuse for upload-pack.
- pack_
rev - Reverse indexes for pack lookups.
- pack_
store - Pack-backed object store implementation.
- pack_
stream_ scan - Count a pack’s objects while its bytes are still arriving.
- pack_
write - Pack and index installation helpers.
- promisor
- promisor API (re-exported at this path).
- promisor_
remote - Promisor remote configuration for partial clones.
- prune_
packed - Prune unreachable packed objects.
- unpack_
objects - Unpack loose objects from pack streams.
Structs§
- Commit
Data - Parsed representation of a commit object.
- Commit
Ref - Parsed commit headers and message body borrowing from the object bytes.
- Extra
Header Iter - Iterator over
(name, value)pairs in a raw extra-header blob. - Hash
Version Error - Error when converting an on-disk hash-version byte to
HashAlgo. - NewCommit
- A commit to create with
Objects::write_commit. - Object
- A decompressed, header-stripped Git object.
- Object
Id - A Git object identifier: a SHA-1 (20-byte) or SHA-256 (32-byte) digest.
- Object
IdPrefix - A parsed abbreviated object id: the leading hex digits (“nibbles”) of a digest.
- Object
Info - Kind and uncompressed size of a Git object without loading its payload.
- Object
Ref - Borrowed view of an object’s kind and uncompressed payload.
- OidBuild
Hasher - Build hasher for
OidHashMapandOidHashSet. - OidHasher
- Hasher state for OID-keyed maps.
- TagData
- Parsed representation of an annotated tag object.
- Tree
Entry - A single entry in a Git tree object.
- Tree
Entry Ref - A single tree entry borrowing name bytes from the tree object payload.
- Tree
RefIter - Iterator over tree entries borrowing from the tree object’s raw payload.
Enums§
- Hash
Algo - A Git hash algorithm.
- Object
Kind - The four Git object types.
- Tree
Entry Error - Why
Objects::write_treerefused an entry.
Functions§
- commit_
subject_ pretty - First paragraph of a commit message, folded like Git
%(contents:subject). - empty_
object_ id_ hash_ set - Shared empty standard OID set for public API boundaries (avoids per-call allocation).
- empty_
oid_ byte_ filter_ map - Shared empty OID → bytes map for commit-graph filter tests and call sites.
- empty_
oid_ set - Shared empty OID set for borrow-only call sites (avoids per-call allocation).
- extra_
header_ values - All values for
name(one entry per header line with that name). - insert_
header_ before_ signature - Insert
linebefore the firstgpgsig/gpgsig-sha256block, dropping existing blocks whose names satisfydrop_key. - iter_
extra_ headers - Iterate
(name, value)pairs in a raw extra-header blob. - next_
header_ block - Advance past one header block (first line plus any SP-prefixed continuations).
- oid_
hash_ map - Empty
OidHashMap. - oid_
hash_ map_ from - Copy a standard OID map into an
OidHashMap. - oid_
hash_ map_ with_ capacity - Empty
OidHashMapwith room for at leastcapacityentries without rehashing. - oid_
hash_ set - Empty
OidHashSet. - oid_
hash_ set_ from - Copy a standard OID set into an
OidHashSet. - oid_
hash_ set_ with_ capacity - Empty
OidHashSetwith room for at leastcapacityentries without rehashing. - parse_
commit - Parse the raw data of a commit object.
- parse_
tag - Parse the raw data of a tag object.
- parse_
tree - Parse the raw data of a tree object into its entries.
- parse_
tree_ with_ oid_ len - Parse a tree blob assuming a fixed raw OID width (
oid_lenbytes). - read_
commit_ subject_ line - First line of the commit message (subject), honoring the
encodingheader. - read_
commit_ subject_ pretty - Subject from commit object bytes (see
commit_subject_pretty). - remove_
header_ lines - Remove every header block whose name satisfies
drop_key. - serialize_
commit - Serialize a
CommitDatainto the raw bytes suitable for storage. - serialize_
tag - Serialize a
TagDatainto the raw bytes suitable for storage as a tag object. - serialize_
tree - Build the raw bytes of a tree object from a slice of entries.
- set_
extra_ header - Replace every header block named
namewithline, or appendlinewhen no such block exists. - tag_
header_ field - Value after
prefixon the first header line that starts withprefix, scanning until a blank line (Git tag headers). ReturnsNoneif no such line exists before the body. - tag_
object_ line_ oid - OID from the first
object <hex>line in the tag header block, if hex parses. - tree_
entry_ cmp - Git’s tree-entry sort comparator.
Type Aliases§
- OidHash
Map HashMapkeyed byObjectIdwithOidBuildHasher(hashbrown table).- OidHash
Set HashSetofObjectIdwithOidBuildHasher(hashbrown table).