Skip to main content

Module objects

Module objects 

Source
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§

CommitData
Parsed representation of a commit object.
CommitRef
Parsed commit headers and message body borrowing from the object bytes.
ExtraHeaderIter
Iterator over (name, value) pairs in a raw extra-header blob.
HashVersionError
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.
ObjectId
A Git object identifier: a SHA-1 (20-byte) or SHA-256 (32-byte) digest.
ObjectIdPrefix
A parsed abbreviated object id: the leading hex digits (“nibbles”) of a digest.
ObjectInfo
Kind and uncompressed size of a Git object without loading its payload.
ObjectRef
Borrowed view of an object’s kind and uncompressed payload.
OidBuildHasher
Build hasher for OidHashMap and OidHashSet.
OidHasher
Hasher state for OID-keyed maps.
TagData
Parsed representation of an annotated tag object.
TreeEntry
A single entry in a Git tree object.
TreeEntryRef
A single tree entry borrowing name bytes from the tree object payload.
TreeRefIter
Iterator over tree entries borrowing from the tree object’s raw payload.

Enums§

HashAlgo
A Git hash algorithm.
ObjectKind
The four Git object types.
TreeEntryError
Why Objects::write_tree refused 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 line before the first gpgsig / gpgsig-sha256 block, dropping existing blocks whose names satisfy drop_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 OidHashMap with room for at least capacity entries 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 OidHashSet with room for at least capacity entries 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_len bytes).
read_commit_subject_line
First line of the commit message (subject), honoring the encoding header.
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 CommitData into the raw bytes suitable for storage.
serialize_tag
Serialize a TagData into 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 name with line, or append line when no such block exists.
tag_header_field
Value after prefix on the first header line that starts with prefix, scanning until a blank line (Git tag headers). Returns None if 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§

OidHashMap
HashMap keyed by ObjectId with OidBuildHasher (hashbrown table).
OidHashSet
HashSet of ObjectId with OidBuildHasher (hashbrown table).