caelum0x ec98430794
Some checks failed
ci / cargo test (abacus) (push) Has been cancelled
ci / cargo test (agent-runtime) (push) Has been cancelled
ci / cargo test (context-passport) (push) Has been cancelled
ci / cargo test (game-economy) (push) Has been cancelled
ci / cargo test (ledgerline) (push) Has been cancelled
ci / cargo test (mint) (push) Has been cancelled
ci / cargo test (rago) (push) Has been cancelled
ci / cargo test (relay) (push) Has been cancelled
ci / cargo test (toolgate) (push) Has been cancelled
ci / cargo test (turnstile) (push) Has been cancelled
ci / cargo test (vend) (push) Has been cancelled
ci / node suites (push) Has been cancelled
feat(rit,gitea): zero-manual-step GitHub->Rithub import (login, CLI, agent) + orphan-comment migrate bug fix
- apps/rit: `rit login` (PKCE OAuth2 against a new first-party "Rit CLI"
  Gitea app, loopback callback, no token paste) and `rit import github`
  (lists own repos+forks via `gh auth token`, smallest-first, skip-
  existing, mirror=true). Wired as a transparent credential fallback into
  remote.rs so push/fetch/pull/clone/issue/pr all work after one login.
  `rit push` also syncs a `github` remote if present via system git.
- apps/gitea/scripts: oauth-auto-import.sh (path 1, cron-driven, triggered
  by Gitea's own GitHub OAuth login source, flock+load-gated) and
  rithub-agent.sh (path 3, plain-words trigger) share lib/bulk-migrate.sh
  as their core.
- Found+fixed two real API bugs via live testing against rithub.dev
  (MigrateRepoOptions.service is a string not an int; a bash bool-
  interpolation bug), and one real production bug (orphan GitHub comments
  on a deleted issue/PR 500 Gitea's comment-import phase even though the
  repo+code already landed -- now detected and reported as a partial
  success with a note instead of a false failure).
- Full real end-to-end verification with a throwaway mail.tm Rithub user,
  fully cleaned up after. 121/121 existing rit tests still pass.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-19 00:12:57 +03:00
..

rit — rust git

rit is a standalone Rust library. It is not the engine that serves rithub.dev.

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.
  • Native upload-pack (rit::upload_pack): protocol-v0 ref advertisement, want/have negotiation, and rit-generated packfiles. This is what rit serve-http and the rithub forge serve to stock git clone/git fetch over smart HTTP and SSH. (The older rit upload-pack stdin/stdout subcommand is a compatibility bridge to an installed Git and is only used for local process transports.)
  • Client transport (rit::remote): rit clone, rit remote add|remove|list, rit fetch, rit pull (fast-forward only), and rit push [--force] against any rithub / smart-HTTP URL or a local repository path. Fetched packs pass through the same quarantined, fsck'd receive transaction as server pushes. HTTP(S) uses the system curl; credentials come from the URL or RIT_USERNAME + RIT_TOKEN (a rithub personal access token) and are passed to curl on stdin, never on the command line.

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, the receive-pack process contract, native upload-pack, and the clone/fetch/push client are Rit-native. Still deferred: protocol v2, side-band progress, shallow clones, packed-refs rewrite/deletion, interrupted-ingest recovery, and SHA-256 repositories.