Skip to main content

turbovault_git/
lib.rs

1//! # turbovault-git — git-native write substrate
2//!
3//! Every vault mutation is a git commit built from plumbing — blobs written to
4//! the object DB, a tree assembled in an **isolated/ephemeral index** (never the
5//! shared `.git/index`), a `commit-tree`, and a **compare-and-swap ref advance**
6//! — then materialized into the working tree. Git history is the rollback/audit
7//! log; `update-ref` CAS is the cross-process serialization primitive.
8//!
9//! Design: `git-write-substrate-architecture.md`. This crate replaces the
10//! legacy `VaultManager` write path (mutators, batch executor, path-lock
11//! registry, audit/snapshot rollback).
12//!
13//! Layers (built bottom-up):
14//! - [`VaultRepo`] — repo handle + detection + branch/HEAD resolution (GWS.1).
15//! - [`TreeChange`] + `build_tree`/`commit_tree` — object-DB plumbing (GWS.2).
16//! - `cas_ref`/`commit_with_retry` — ref compare-and-swap + optimistic
17//!   rebuild-on-conflict (GWS.3).
18//! - (next) per-file precondition, materialization, changesets (GWS.4+).
19
20#![forbid(unsafe_code)]
21
22mod cas;
23mod changeset;
24mod error;
25mod fanout;
26mod locks;
27mod materialize;
28mod occ;
29mod plumbing;
30mod repo;
31mod restore;
32
33pub use changeset::{Changeset, ChangesetResult};
34pub use error::{Error, Result};
35pub use fanout::{FanoutInfo, FanoutWorktree, MergeBackResult, MergeStrategy, OrphanFanout};
36pub use locks::CommitLocks;
37pub use occ::Precondition;
38pub use plumbing::TreeChange;
39pub use repo::{CommitHook, VaultRepo};
40
41/// Re-exported so substrate consumers (e.g. `turbovault-tools`) can talk about
42/// blob/commit oids without taking a direct `git2` dep — preserves the
43/// substrate's role as the only crate that knows about libgit2.
44pub use git2::Oid;