Skip to main content

grit_lib/objects/
mod.rs

1//! Git objects: ids, kinds, in-memory representations, and the object database stack.
2//!
3//! Canonical layout groups loose/packed storage, hashing, deltas, and reachability
4//! bitmaps under this module.
5//!
6//! Library guide: [mod](https://grit-scm.com/docs/library/objects)
7//!
8//! ```rust
9//! use grit_lib::repo::{InitOptions, Repository};
10//! # fn main() -> grit_lib::error::Result<()> {
11//! let dir = tempfile::tempdir()?;
12//! let _repo = Repository::init(dir.path(), &InitOptions::default())?;
13//! let _odb = _repo.odb();
14//!
15//! # Ok(())
16//! # }
17//! ```
18
19mod commit_ref;
20mod core;
21mod extra_headers;
22pub mod handle;
23mod oid_hashtable;
24mod write;
25
26pub(crate) use commit_ref::commit_author_and_message_lenient;
27pub use commit_ref::CommitRef;
28pub use core::*;
29pub use extra_headers::{
30    extra_header_values, insert_header_before_signature, iter_extra_headers, next_header_block,
31    remove_header_lines, set_extra_header, ExtraHeaderIter,
32};
33pub use handle::Objects;
34pub use oid_hashtable::{
35    empty_object_id_hash_set, empty_oid_byte_filter_map, empty_oid_set, oid_hash_map,
36    oid_hash_map_from, oid_hash_map_with_capacity, oid_hash_set, oid_hash_set_from,
37    oid_hash_set_with_capacity, OidBuildHasher, OidHashMap, OidHashSet, OidHasher,
38};
39pub use write::{NewCommit, TreeEntryError, WriteTreeOptions};
40
41pub use crate::change_id::{
42    change_id, find_commits_by_change_id_prefix, is_change_id_spec_token,
43    resolve_commit_by_change_id_prefix, resolved_change_id, set_change_id, ChangeId, ChangeIdError,
44    ChangeIdGenerator, ChangeIdMatch, ChangeIdPolicy, OsChangeIdGenerator, ResolvedChangeId,
45};
46
47pub mod odb {
48    //! Object database backends and loose/packed storage.
49    pub use crate::odb::builder;
50    pub use crate::odb::store;
51    pub use crate::odb::*;
52}
53
54pub mod pack {
55    //! Pack files, indexes, and packfile I/O.
56    pub use crate::pack::*;
57    pub use crate::pack_reuse_root::*;
58}
59
60pub mod bench_fixture {
61    //! Synthetic repository fixtures for benchmarks and tests.
62    pub use crate::bench_fixture_root::*;
63}
64pub mod pack_reuse {
65    //! Verbatim pack reuse for upload-pack.
66    pub use crate::pack_reuse_root::*;
67}
68pub mod pack_write {
69    //! Pack and index installation helpers.
70    pub use crate::pack_write_root::*;
71}
72
73pub mod midx {
74    //! Multi-pack-index (MIDX) read and write.
75    pub use crate::midx::*;
76}
77
78pub mod hash {
79    //! Object-id hashing, file checksums, and hash algorithm selection.
80    pub use crate::hash::*;
81}
82
83pub mod commit_graph {
84    //! Commit-graph files for reachability and generation numbers.
85    pub use crate::commit_graph_file::*;
86    pub use crate::commit_graph_write::*;
87}
88
89pub mod bitmap {
90    //! Pack and commit reachability bitmaps.
91    pub use crate::bitmap_walk::*;
92    pub use crate::pack_bitmap::{
93        BitmapError, BitmapIndex, BitmapIndexCache, CommitReachabilityBitmap, MidxBitmapWriter,
94        PackBitmapWriteError, PackBitmapWriteOptions, PackBitmapWriter, TypeBitmap,
95    };
96}
97
98pub mod delta_encode {
99    //! Delta compression encoding for pack streams.
100    pub use crate::delta_encode::*;
101}
102pub mod delta_islands {
103    //! Delta island boundaries for pack reuse.
104    pub use crate::delta_islands::*;
105}
106pub mod index_pack {
107    //! Index-pack and thin-pack handling.
108    pub use crate::index_pack::*;
109}
110pub mod pack_name_hash {
111    //! Name-hash tables for delta base selection.
112    pub use crate::pack_name_hash::*;
113}
114pub mod pack_rev {
115    //! Reverse indexes for pack lookups.
116    pub use crate::pack_rev::*;
117}
118pub mod pack_store {
119    //! Pack-backed object store implementation.
120    pub use crate::pack_store::*;
121}
122pub mod unpack_objects {
123    //! Unpack loose objects from pack streams.
124    pub use crate::unpack_objects::*;
125}
126pub mod prune_packed {
127    //! Prune unreachable packed objects.
128    pub use crate::prune_packed::*;
129}
130pub mod promisor {
131    //! promisor API (re-exported at this path).
132    pub use crate::promisor::*;
133    pub use crate::promisor_fetch::{
134        DefaultPromisorFetcher, PromisorFetcher, PROMISOR_LAZY_FETCH_CONFIG,
135    };
136}
137pub mod promisor_remote {
138    //! Promisor remote configuration for partial clones.
139    pub use crate::promisor_remote::*;
140}
141pub mod pack_objects {
142    //! Pack-objects negotiation and encoding.
143    pub use crate::pack_objects::*;
144}
145pub mod pack_object_select {
146    //! Object selection heuristics for packing.
147    pub use crate::pack_object_select::*;
148}
149pub mod pack_receive {
150    //! Receive-pack side pack ingestion.
151    pub use crate::pack_receive::*;
152}
153pub mod pack_stream_scan {
154    //! Count a pack's objects while its bytes are still arriving.
155    pub use crate::pack_stream_scan::*;
156}
157
158#[cfg(feature = "unstable-bench-helpers")]
159#[allow(missing_docs)]
160pub mod ewah_bench {
161    //! Criterion fixtures for EWAH bitmap hot paths (`benches/ewah.rs` only).
162    include!("../ewah_bench_api.rs");
163}