panproto_git/lib.rs
1//! # panproto-git
2//!
3//! Bidirectional git ↔ panproto-vcs translation bridge.
4//!
5//! Enables `git push cospan main` by translating between git repositories
6//! and panproto-vcs stores. On import, git trees are parsed through
7//! `panproto-project` to produce structural schemas. On export, schemas
8//! are emitted back to source text via `panproto-parse` emitters.
9//!
10//! ## Import flow (git → panproto)
11//!
12//! 1. Walk git commit DAG topologically (parents before children)
13//! 2. For each commit: read all files from the git tree
14//! 3. Parse each file through its language parser (via `panproto-project`)
15//! 4. Assemble project-level schema (coproduct)
16//! 5. Store schema and create panproto-vcs commit (preserving author, timestamp, message)
17//!
18//! ## Export flow (panproto → git)
19//!
20//! 1. Load project schema from panproto-vcs commit
21//! 2. Emit source files via panproto-parse emitters
22//! 3. Build git tree and commit objects
23//!
24//! ## Functoriality
25//!
26//! Import preserves DAG structure: parent pointers in panproto-vcs match the
27//! git DAG. Composition of imports matches import of composition:
28//! `import(a ; b) = import(a) ; import(b)`.
29
30/// Error types for git bridge operations.
31pub mod error;
32
33/// Import git repositories into panproto-vcs.
34pub mod import;
35
36/// Export panproto-vcs repositories to git.
37pub mod export;
38
39#[cfg(test)]
40mod tests;
41
42pub use error::GitBridgeError;
43pub use export::ExportResult;
44pub use export::export_to_git;
45pub use import::{ImportResult, import_git_repo};