Lutra/crates/vcs/src/lib.rs
danny 13e7b0aa12 M4.1: Git backend through the installed git
New crate lutra-vcs (L3): a safe git runner (argument arrays, no prompts,
GIT_OPTIONAL_LOCKS=0 for reads, timeouts 30 s / 120 s for hooks, output
caps, one spawn function for H1's kill-on-close helper), porcelain v2 / -z
parsers (property-tested), Repo operations (status, stage, unstage before
the first commit, commit and amend, show at HEAD/index, branches, checkout
with remote tracking, branch creation checked by check-ref-format) and a
.git poll (RepoWatch).

Engine: git.status, git.stage, git.unstage, git.commit, git.show,
git.branches, git.checkout, git.createBranch on pending outcomes, off the
engine lock; gitChanged after changes and debounced 300 ms on .git or
project changes; setting git.executable (section Git).

Tests against real temp repositories, engine tests through run_waiting,
docs (architecture, gaps G8, Git parity row, roadmap M4 row).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 16:52:29 +01:00

32 lines
1.2 KiB
Rust

//! Git for Lutra (layer L3), through the user's installed `git` command
//! (owner decision D20).
//!
//! - [`Git::detect`] finds git (the `git.executable` setting or `PATH`) and
//! checks it is at least [`MIN_VERSION`].
//! - [`Git::open`] opens the repository containing a project folder.
//! - [`Repo`] runs status, stage, unstage, commit, show, branches,
//! checkout and branch creation. Calls that change the repository are
//! serialised per repository.
//! - [`RepoWatch`] notices changes inside `.git` (HEAD, index, refs).
//!
//! Every call goes through [`runner::run`]: arguments as an array, never a
//! shell; no terminal or credential prompts; a timeout; capped output;
//! machine-readable output only (porcelain v2, `-z`, NUL-separated
//! formats). No network operation exists here.
//!
//! Calls block for as long as git runs, so the engine runs them on their
//! own threads, off its lock.
mod error;
pub mod porcelain;
mod repo;
pub mod runner;
mod watch;
pub use error::VcsError;
pub use porcelain::{FileState, FileStatus, Head, Status, Version};
pub use repo::{
Branch, Branches, CommitInfo, Contents, FILE_CAP, Git, MIN_VERSION, Repo, Rev, STATUS_CAP,
decode,
};
pub use watch::{RepoWatch, fingerprint};