loom-git · crate
Source declarations, signatures and documentation for crate.
Source: sigil/weave/tools/loom-git/src/lib.rs. SHA-256: 7084cbf42bf7897599d5973d770912ec1c6b00ff43c27191f2c0e55863060245.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
export
loom-git — git ↔ loom transpiler.
This crate converts git history into a loom-shaped commit graph (and back).
It produces a pure data structure ([ImportPlan]) that callers drain into a
real loom repo by writing blobs and appending commits — that keeps the
library independent of the WeaveNode runtime and easy to test.
Why a transpiler matters
Adoption hinges on agents being able to migrate existing git repos onto loom (and back, for safety). A round-trip-verified import means an agent can switch from git to loom without losing history, then export back to git if they ever want to leave. That's the migration on-ramp the "I'd use this over Git" bar requires.
What's preserved
- Commit graph: parents and merges (topo-sorted, parents-first)
- Authorship: git author is preserved verbatim in a structured field; the importing agent's DID is the canonical signer (chain of custody is imported-by, original-by, recorded in the commit message + structured trailer)
- Tree contents: blobs deduped via BLAKE3; file modes mapped to
loom's
FileMode(Regular / Executable / Symlink) - Timestamps: author timestamp from git
- Round-trip key: each loom commit records its source git oid so the
exporter can reconstruct identical trees and rebuild a corresponding
git commit graph (export direction lives in this crate too — see
export.rs, future iteration)
pub mod export;Source line: 31.
import
pub mod import;Source line: 32.
plan
pub mod plan;Source line: 33.
schema
pub mod schema;Source line: 34.
pub use export::{export_to_git, ExportCommit, ExportPlan, ExportReport};
pub use export::{export_to_git, ExportCommit, ExportPlan, ExportReport};Source line: 36.
pub use import::{import_git, ImportOpts, ImportReport};
pub use import::{import_git, ImportOpts, ImportReport};Source line: 37.
pub use plan::{BlobDraft, CommitDraft, ImportPlan};
pub use plan::{BlobDraft, CommitDraft, ImportPlan};Source line: 38.
pub use schema::{Commit, FileMode, ManifestEntry, TreeManifest};
pub use schema::{Commit, FileMode, ManifestEntry, TreeManifest};Source line: 39.
::Error
Errors emitted by loom-git.
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("git plumbing error: {0}")]
Git(String),
#[error("io: {0}")]
Io(#[from] std::io::Error),
#[error("malformed git tree at {oid}: {reason}")]
BadTree { oid: String, reason: String },
#[error("unsupported git object kind for path '{path}': {kind}")]
UnsupportedObject { path: String, kind: String },
}Source line: 43.
::Result
pub type Result<T> = std::result::Result<T, Error>;Source line: 54.