16 releases (5 breaking)
Uses new Rust 2024
| 0.5.2 | Jul 29, 2026 |
|---|---|
| 0.5.1 | Jul 29, 2026 |
| 0.4.4 | Jul 12, 2026 |
| 0.3.1 | Jun 27, 2026 |
| 0.0.3 | Jun 16, 2026 |
#2524 in Filesystem
3,869 downloads per month
Used in 25 crates
(12 directly)
6.5MB
154K
SLoC
sley — the embeddable facade over Sley's native Git-equivalent engine.
Downstream code that wants a "just open a repository and read things" entry
point should reach for Repository rather than wiring the plumbing crates
together by hand. A Repository is a lightweight handle around a resolved
git directory: it remembers the git_dir, the common directory (for linked
worktrees), and the repository's object format, and hands back the
underlying plumbing objects (sley_odb::FileObjectDatabase,
sley_refs::FileRefStore, sley_config::GitConfig) on demand.
Embedder surface (feature remote, on by default):
Repository::config_snapshot— full git config withinclude/includeIf/hasconfig:resolution.Repository::init_mirror— bare mirror defaults (+refs/*:refs/*,mirror = trueonorigin).Repository::copy_reachable_from— pack-based object transfer.clone_repository— thin free-function clone of a resolved remote (re-export ofsley_remote::clone).Repository::remote/remote::RemoteContext— URL rewriting andsley_remotefetch/push/clone/ls-remote orchestration (HTTP v2 fetch, SSH, bundle fetch, thin-pack push). Porcelain paths on the facade (Repository::push, and future commit/checkout helpers) invoke git hooks viahookswhen a hook is configured.- Cancel — cooperative stream cancellation for pack receive/generate:
AtomicCancel,CancelFlag,CancellableRead,OperationContext, plusRepository::{fetch,push,push_actions}_with_cancel. pack/protocol— repository-free streaming pack indexing and upload-pack sideband demultiplexing for custom storage pipelines.hooks— traditional and config-defined hook discovery/execution.OpenOptions::respect_environment/Repository::open_from_environment— honorGIT_DIR,GIT_WORK_TREE, and related discovery env vars.notes— git notes read/write for round-trip fidelity.Repository::capabilities/Repository::transport_capabilities— capability probes before calling in.
For power users the engine crates are re-exported under plumbing (and the
most common types are re-exported at the crate root), so a single
git = { path = ... } dependency is enough to reach the whole stack.
use sley::Repository;
let repo = Repository::discover(".")?;
let head = repo.head()?;
if let Some(oid) = head.oid {
let commit = repo.read_commit(&oid)?;
let _ = commit.tree;
}
Dependencies
~7–19MB
~306K SLoC