Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

InterPlanetary Version Control (call it IPVC?)

IPLD-based Version History

This is just a sketch of a possibility. If we just want a git-style toolchain with git version graph, it might be better to just put an ipfs storage adapter behind go-git -- basically putting IPFS unixfs trees where git usually creates git tree objects. In that case you would have regular git commit objects, not IPLD objects. That would be less reusable beyond the git context but it would fit better with existing git-based tooling.

Keep in mind: it will be really useful to be able to use IPFS files api to manipulate these trees, allowing you to do things like modify part of a large dataset and commit the changes without ever pulling the whole dataset -- you can just pull the parts that you're changing.

Features

  • Cryptographically-tracked version History
  • Metadata (both required and optional) for commits in the version history (author, timestamp, log message, gpg signature)
  • Named Branches and "refs": mutable names that point to commits
  • View log history

Commands

Some commands we need in the version-control toolchain

ASIDE: What is an MVP here? We don't want to recreate all of git. Just want to provide clear, reliable tools for creating version history layer in IPFS.

ipvc repo init <repository-name> / initialize a new ipvc repo in ipfs & generate an ipns name for it ipvc repo list / list all local ipvc repositories ipvc clone <repository-hash> / pull the repo corresponding to <repository-hash> onto the local machine ipvc commit <ipfs-hash> / add as the new head ipvc rebase -r <repository-hash> ipvc log

ipvc repo add

Implementation Notes

Version entry (modeled on git commit objects):

Example of git commit object: TODO: get a real, complete example with gpg info

commit QmUmg7BZC1YP1ca66rRtWKxpXp77WgVHrnv263JtDuvs2k
Author: Ada Lovelace <ada@lovela.ce>
Date:   Fri June 22 18:15:24 1833 -0000

Expressing this information as IPLD:

{
  "commit": {"/":"/ipfs/QmUmg7BZC1YP1ca66rRtWKxpXp77WgVHrnv263JtDuvs2k"},
  "message": "this is a commit message",
  "parent": {"/":"/ipfs/d1c37bcb9f75ac4fba968b47db9dcbd697bd453a"},
  "Author": "Ada Lovelace <ada@lovela.ce>",
  "Date": "Fri June 22 18:15:24 1833 -0000",
  // optional gpg signatuure info
  "signature": { // gpg signature info }
}

imagine that the hash of this is

Version History:

{
  "head": {"/": "../versions/0"}
  "versions": [
    {"/":<hash-of-v3>},
    {"/":<hash-of-v2>},
    {"/":<hash-of-v1>}
  ]
  }
}

imagine that the hash of this is

Make the ipns entry point to

Example IPLD paths:

/ipns/<ipns-hash/head

/ipns/<ipns-hash/head/commit

Equivalent of git cat head^2 /ipns/<ipns-hash/2/commit which resolves to the same thing as /ipns/<ipns-hash/1/parent/commit

@RMBLRX
Copy link

RMBLRX commented Nov 17, 2017

Just saw this and was wondering whether you think GVFS might have some bearing on how IPVC could hypothetically function.

@ProgrammerWhoPrograms
Copy link

ProgrammerWhoPrograms commented Jun 11, 2022

https://hypercore-protocol.org is built on version control, if anyone's interested,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment