- crates/vcs chunk.rs: chunks of a file (buffer text vs index, HEAD vs
index), a minimal patch applied with git apply --cached, revert as a
byte edit; token refusal when buffer, index or HEAD changed; CRLF
(autocrlf and stored), no final newline, BOM, staged renames, first
commit; binary and untracked refused. Real-git tests + property test.
- engine: git.chunks, git.stageChunk, git.unstageChunk, git.revertChunk
(revert edits the buffer under the lock, undoable in the editor);
cmd:
:start_then; git.lineChanges shares the vcs line diff.
- UI: chunk popup on a gutter marker click (Stage / Unstage / Revert /
Previous / Next), hollow staged markers, vcs.showChunk, diff viewer
hint, "partly staged" badge in the Changes window.
- Docs: G8 row, Git parity row evidence, ui-parity, architecture.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
2.4 KiB
Rust
62 lines
2.4 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.
|
|
//! - Remotes (M4.10, owner decision D23): fetch, pull, push, clone and
|
|
//! remote management, with progress and cancel; credentials stay with
|
|
//! git's credential helper and the ssh agent (see `remote.rs`).
|
|
//! - Blame (M4.7): who last changed each line, of the working copy or an
|
|
//! editor buffer (`blame.rs`).
|
|
//! - Ignoring files (C7 A3): literal patterns appended to `.gitignore`
|
|
//! (`ignore.rs`).
|
|
//! - Chunks (C8 C3): the changed chunks of a file against the index and
|
|
//! HEAD; staging, unstaging and reverting one (`chunk.rs`).
|
|
//! - [`RepoWatch`] notices changes inside `.git` (HEAD, index, refs).
|
|
//!
|
|
//! Every call goes through [`runner::run`]: arguments as an array, never a
|
|
//! shell; no terminal prompts (network calls allow the credential helper's
|
|
//! own window); a timeout; capped output; machine-readable output only
|
|
//! (porcelain v2, `-z`, NUL-separated formats); URL userinfo redacted in
|
|
//! messages.
|
|
//!
|
|
//! Calls block for as long as git runs, so the engine runs them on their
|
|
//! own threads, off its lock.
|
|
|
|
pub mod blame;
|
|
pub mod chunk;
|
|
mod error;
|
|
mod ignore;
|
|
pub mod log;
|
|
pub mod porcelain;
|
|
mod remote;
|
|
mod repo;
|
|
pub mod runner;
|
|
pub mod stash;
|
|
mod watch;
|
|
|
|
pub use blame::{BlameLine, UNCOMMITTED_AUTHOR, is_uncommitted};
|
|
pub use chunk::{Chunk, FileChunks, TextEdit};
|
|
pub use error::VcsError;
|
|
pub use ignore::ignore_pattern;
|
|
pub use log::{CommitDetails, CommitFile, LOG_LIMIT, LogCommit, LogQuery};
|
|
pub use porcelain::{FileState, FileStatus, Head, Status, Version};
|
|
pub use remote::{
|
|
MAX_URL_LEN, Network, PullMode, Pushed, Remote, check_remote_name, check_url, explain,
|
|
parse_progress,
|
|
};
|
|
pub use repo::{
|
|
Branch, Branches, CommitInfo, Contents, FILE_CAP, Git, MIN_VERSION, Repo, Rev, STATUS_CAP,
|
|
decode,
|
|
};
|
|
pub use runner::{Cancel, ProgressSink, redact_urls};
|
|
pub use stash::StashEntry;
|
|
pub use watch::{RepoWatch, fingerprint};
|
|
mod merge;
|
|
pub use merge::{
|
|
CheckLine, ConflictVersions, MergeOutcome, MergeResult, parse_check_line, parse_unmerged,
|
|
};
|