Expand description
Git-Internal: a high-performance Rust library for Git objects and pack files—encode/decode, delta (ref/offset/zstd), caching, streaming, and sync/async pipelines.
Goals
- Provide high-performance parsing and generation of Git pack format and Git objects.
- Support both file-based and streaming inputs of Git Pack.
- Offer synchronous and asynchronous APIs for multi-threaded and Tokio runtimes.
Core Capabilities
- Decoding: base objects and delta objects (Ref-Delta, Offset-Delta, ZstdDelta).
- Encoding: serial and parallel pipelines; offset deltas and Zstd-based deltas.
- Streaming:
decode_streamforStream<Bytes>;decode_asyncdecodes in a new thread and sends entries. - Caching & memory: LRU-based cache;
MemSizeRecordertracks heap usage; optionalmem_limitto bound memory. - Utilities: Hash-stream helpers, zlib, delta, zstdelta toolkits.
Modules
internal::pack: decode/encode, caches, waitlists, parallel pipelines, helpers.internal::object: Blob/Tree/Commit/Tag/Note objects, type enum, object trait.internal::zlib: compression/decompression stream utilities.deltaandzstdelta: delta algorithms and rebuild helpers.errors: unified error types.hash: Hash helpers.utils: common utilities (e.g.,CountingReader).
Typical Usage
- Offline large-file decode:
Pack::decode_async(reader, sender)decodes in a thread and sendsEntrys. - Stream decode:
Pack::decode_stream(stream, sender)consumesReaderStreamunder Tokio. - Parallel encode:
encode_async/parallel_encodebuild packs from many objects.
Test Data
- Located under
tests/data/, includes real pack files and object sets.
Re-exports§
pub use diff::Diff;pub use diff::DiffItem;pub use protocol::AuthenticationService;pub use protocol::GitProtocol;pub use protocol::ProtocolError;pub use protocol::RepositoryAccess;pub use protocol::ServiceType;
Modules§
- diff
- Unified diff generation utilities that compare blobs/trees, map deltas back to line numbers, and emit Myers-based unified diffs for Git objects while guarding against pathological inputs.
- errors
- Error types for the Git-Internal crate.
- hash
- Hash utilities for Git objects with selectable algorithms (SHA-1 and SHA-256). Hash kind is stored thread-locally; set once at startup to match your repository format. Defaults to SHA-1.
- internal
- Internal building blocks (index, metadata, object model, pack/zlib) that power the public APIs.
- protocol
- Git smart-protocol façade that re-exports core traits, transport adapters, capability types, and helpers so embedders can speak Git over HTTP/SSH or custom transports with minimal plumbing.
- utils
- Shared I/O utilities for Git-internal including buffered readers, SHA abstractions, and helpers for reading pack/file bytes while tracking stream progress.
Macros§
- time_it
- Count the time taken to execute a block of code.