Skip to content
no-std-rsPublic

About

Allocation-free Git toolkit in safe no_std Rust: objects, packs, and HTTP clients and servers for native, bare-metal, and WebAssembly targets.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

git-zero

CI Runnerless CI: slowest job Git versus git-zero: discovery wall time

An allocation-free Git toolkit in safe no_std Rust: objects, packs, clients, and servers. Callers supply repository data, buffers, storage, and I/O. The same core runs on native systems, bare-metal targets, and WebAssembly.

The library crates use neither std nor alloc. Native CLI startup and the JavaScript hosting layers have their own memory and runtime requirements. This is a set of Git building blocks, with a demonstration CLI and host examples.

Benchmarks

Git versus git-zero benchmark report

Every main push and PR measures discovery, clone and fetch against pinned Git with matched compression and delta settings. Runnerless processes the original observations and publishes the report; PR runs also receive a benchmark comment. The chart shows warm-cache descriptive medians on GitHub-hosted Linux runners. See collection, retention and manual reruns for the scope.

Choose a crate

Crate Use it for API
git-zero Combined API with optional client and server reexports git_zero
git-zero-core Objects, repositories, packs, decoding, and caller-owned caches git_zero_core
git-zero-client Fetching through a host-provided HTTP transport git_zero_client
git-zero-server Smart/dumb HTTP serving and opt-in receive-pack primitives git_zero_server
git-zero-rustix Native file/socket adapters and the git-zero CLI git_zero_rustix

All five crates share version 0.1.0 and require Rust 1.85 or newer.

[dependencies]
git-zero = "0.1.0"

The facade enables read, write, client, and server by default. For a fetch-only dependency, select just the client:

git-zero = { version = "0.1.0", default-features = false, features = ["client"] }

For example, construct a repository from borrowed files and fixed buffers:

use git_zero::{File, Repository, Snapshot};

fn main() -> git_zero::Result<()> {
    let files = [File { name: "hello.txt", contents: b"Hello from git-zero!\n" }];
    let mut tree = [0; 256];
    let mut commit = [0; 512];
    let repository = Snapshot::new(&files, &mut tree, &mut commit)?;
    assert_eq!(repository.object_count(), 3); // Commit, tree, and blob.
    Ok(())
}

The embedding guide shows custom repositories, streaming, validation, and host-owned storage.

What works

  • SHA-1/SHA-256 objects, refs, trees, commits, and synthetic snapshots.
  • Smart HTTP serving over protocol v0/v1/v2, plus loose and packed dumb HTTP.
  • Bounded fetch selection, shallow/history filters, and streamed responses.
  • Transport-independent fetching, zlib/pack decoding, and delta resolution.
  • Caller-owned selected-pack caches, a native disk backend, and opt-in Worker KV/R2 storage.
  • Native file/socket adapters, request/response deadlines, and bounded chunked intake.
  • Durable Cloudflare hosting with authenticated push, clone and fetch, atomic ref updates, compressed packs, thin pushes and cold-start recovery.

Snapshot HTTP APIs serve caller-provided read-only repositories. The separate repository host accepts pushes through our own no_std Rust Wasm codec and stores data in Cloudflare R2 and SQLite Durable Objects. Its local tests use actual Wrangler bindings and ordinary Git clients. Full Linux-scale hosting and deployed resource costs remain unverified; the host guide records the platform limits and remaining compatibility gaps.

Try the native CLI

Install the native adapter package, which supplies the git-zero executable:

cargo install git-zero-rustix --version 0.1.0 --locked
git-zero serve 8080

For a source checkout, run from the repository root instead:

cargo run -p git-zero-rustix --bin git-zero -- serve 8080

Then, in another terminal:

git clone http://127.0.0.1:8080/repo.git demo

This serves a fixed in-memory snapshot. The git-zero executable also works as the Git subcommand git zero. The native demo uses HTTP with numeric addresses; the client library lets the host supply a different transport. See usage for client commands, file-backed storage, crate features, and the Worker demo.

Documentation

For plans and project workflow, see the roadmap and contribution guide.

Licensed under MIT OR Apache-2.0.

About

Allocation-free Git toolkit in safe no_std Rust: objects, packs, and HTTP clients and servers for native, bare-metal, and WebAssembly targets.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages