caelum0x 7354d14722 feat(rit): Phase 3-4 — exchange (atomic receive-pack, delta packs, smart-HTTP) + history editing
- multi-ref ATOMIC receive-pack (two-phase ref txn, 'atomic' cap); OFS_DELTA pack gen (window=10, fsck-clean vs real git)
- smart-HTTP (axum): /info/refs + /git-upload-pack|/git-receive-pack; real git clone+push verified; serve-http CLI
- merge (--no-ff/--continue/--abort), sequencer rebase+cherry-pick (--continue/--abort/--skip), stash (push/list/apply/pop/drop)
- deps axum+tokio (offline-compilable); cargo 0; 87 lib + 34 interop tests pass

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-09-23 18:41:59 +03:00

rit — rust git

A library-first Rust implementation of Git's local object/authoring model. rit owns its safety-critical loose-object, index, tree, commit, and ref-transaction paths while adopting audited open-source crates for expensive commodity layers. It is byte-for-byte compatible with real Git where claimed (interop-tested against git 2.50).

  • Object model: loose blobs/trees/commits/tags (read + write), git-exact SHA-1, canonical framing.
  • ODB (zlib, atomic no-clobber writes, SHA-1 verification on read), refs (HEAD/loose/packed/symbolic plus atomic compare-and-swap updates).
  • Checksum-verifying Git index v2/v3 reader, atomic index.lock mutation, recursive ignore-aware add, tracked deletion staging, and symlink/path-safe status.
  • Canonical recursive write-tree, Git commit objects, and atomic branch compare-and-swap updates.
  • Transactional checkout-tree materialization with whole-operation collision preflight, symlink/path confinement, atomic file replacement, and matching index synchronization. restore explicitly replaces selected tracked paths from the current index without moving HEAD or rewriting the index.
  • Strict binary pkt-line framing (including protocol-v2 delimiter/response-end controls), receive-pack command/capability parsing, and report-status encoding.
  • Raw and thin Git pack import through gitoxide with checksum/index/delta verification, target-ODB base lookup, and a two-phase scratch/quarantine boundary. Decoded objects then pass declared-OID, byte/object/graph bounds, strict connectivity/fsck, tree/type validation, fast-forward enforcement, immutable object publication, and one atomic ref CAS. Expected-old deletion is supported for loose refs and refuses packed backing values. Failed receives never move a ref; disconnected objects are not published.
  • rit CLI: hash-object, cat-file, ls-tree, log, status, add, write-tree, commit, checkout-tree, restore, plus a stateful stdin/stdout receive-pack process server for local/SSH adapters and an argument-safe upload-pack bridge to the installed open-source Git backend.
  • Real-git interop proves our OIDs match git hash-object, git fsck accepts objects we write, and real Git can read/write-tree from an index authored by rit. Checkout/restore interop also covers modified/untracked collision refusal and symlink-parent escape attempts.
  • Full and genuinely thin packs generated by stock Git can be staged through receive quarantine into a bare target and pass git fsck --strict after promotion. Corrupt/truncated packs and thin packs with missing bases publish neither objects nor refs.
  • Stock git push --receive-pack='<rit> receive-pack' creates and fast-forwards a bare repository through the process server and deletes loose refs. A client --force does not bypass the server's non-fast-forward policy; deleting a packed ref fails without exposing or changing its old value.
  • Stock git clone/fetch --upload-pack='<rit> upload-pack' works through the explicit compatibility bridge. This fetch path requires Git at runtime and is not misrepresented as Rit-native protocol implementation.

The collaboration forge built on this core lives in ../rithub (the GitHub equivalent).

Open-source foundations: packed-object reads and received pack/index/delta verification use gitoxide; ignore patterns use globset. rit does not pretend these costly primitives were written from scratch.

The protocol boundary follows Git's official gitprotocol-common, gitprotocol-v2, and gitprotocol-pack specifications. Pkt-line, raw/thin pack ingestion, decoded receive safety, and the stateful receive-pack process contract are Rit-native. Clone/fetch is functional through the tested stock-Git upload-pack bridge. Smart-HTTP/SSH listener integration, native Rust upload-pack/fetch, multi-ref atomic updates (including mixed deletions), packed-refs rewrite/deletion, merge/rebase, interrupted-ingest recovery, and SHA-256 remain deferred. rithub stays blocked on those gates—it must not turn this safe receive core into a claim of a complete forge transport.

Description
rit — a library-first Rust implementation of git's object/authoring model. Library, not the production forge engine.
Readme 240 KiB
Languages
Rust 100%