Skip to content

git: a git repository as a storage backend - #49

Merged
trissim merged 1 commit into
mainfrom
git-backend
Nov 20, 2026
Merged

trissim merged 1 commit into
mainfrom
git-backend

Conversation

@trissim

@trissim trissim commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

GitBackend: one branch of a bare git repository as a Polystore backend, through git plumbing only.

  • Filesystem-style reads and writes of bytes/text; checkpoint(message) records the staged tree as a commit and moves the branch atomically (fsynced).
  • history, restore, fork, reads at any past checkpoint (ref=), and blob_id/tree_id content ids for validating anything derived from stored content.
  • A checkpoint only replaces the head the instance started from: a concurrent writer is a raised conflict, not a lost update.
  • Context-specific backends declare requires_context on the class; create_storage_registry asks the class instead of a list of names.

Tests: 620 passed, 5 skipped (13 new in tests/test_git_backend.py).

🤖 Generated with Claude Code

https://claude.ai/code/session_01XbFMSmfWxP4Wnm2cFnvSCk

GitBackend is one branch of a bare repository, written through its own staging index with
git plumbing (no work tree, no user configuration, no hooks). Writes stage; checkpoint()
records the staged tree as a commit and moves the branch atomically, fsynced, which is the
durability point. Identical content is stored once and packed with deltas: forty revisions
of one document pack to under two copies.

It reads and lists like a filesystem (load, list_files, list_dir, is_file, is_dir, move,
copy, delete), reads any past checkpoint (ref=), and adds what versioned content needs:
history (per path), restore (a return to a past tree is a new commit), fork, and
blob_id/tree_id, which name content so anything derived from it can be validated by id. A
checkpoint moves the branch only from the head the instance started from, so a second
writer's commit is a raised conflict, never a lost update.

Backends that need application context to construct now declare it (requires_context) on
the class; create_storage_registry asks the class, replacing its hand-kept list of names.

Tests: 620 passed (13 new).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XbFMSmfWxP4Wnm2cFnvSCk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant