Skip to content

Implement git-remote-freenet helper binary #2

@sanity

Description

@sanity

Problem

The git remote helper binary that lets git natively use freenet: URLs.

What needs to happen

git-remote-freenet implements the git remote helper protocol:

  • Read commands from stdin: capabilities, list, fetch, push.
  • Write responses to stdout per the protocol.
  • Must be on PATH; git invokes it automatically when it sees a freenet: URL.

list

Read the repo contract via WS GET, return the refs from RepoState.refs.

fetch

For each commit requested:

  1. Walk RepoState.object_index, pull SinglePack bundles whose pack contains commits in our want set.
  2. For each pack, GET the pack contract by id (pack_contract_id helper already exists).
  3. Verify BLAKE3(pack_bytes) matches what we expect, then unpack into .git/objects.

push

  1. Build a packfile of new objects with git pack-objects.
  2. PUT the pack as a new pack-contract instance.
  3. Sign and submit a delta to the repo contract that adds the bundle to object_index and updates refs[ref] to the new commit.
  4. Subscribe to the repo contract; wait for the network to reflect our update is the visible head.
  5. If the visible head is someone else's update (race), surface "superseded — please rebase" via stderr and exit non-zero.

Phase 1.0 simplifications

  • SinglePack only (no ChunkedPack support; reject contracts that have unfetchable ChunkedPack records with a clear message).
  • Single-writer; the helper signs as the loaded identity.

Pointers

[AI-assisted - Claude]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions