Skip to content

ipfs/go-ipld-git

Repository files navigation

Git ipld format

An IPLD codec for git objects allowing path traversals across the git graph.

Table of Contents

Install

go get github.com/ipfs/go-ipld-git

About

This is an IPLD codec which handles git objects. Objects are transformed into IPLD graph as detailed below. Objects are demonstrated here using both IPLD Schemas and example JSON forms.

Commit

type GpgSig string

type PersonInfo struct {
  date String
  timezone String
  email String
  name String
}

type Commit struct {
  tree &Tree # see "Tree" section below
  parents [&Commit]
  message String
  author optional PersonInfo
  committer optional PersonInfo
  encoding optional String
  signature optional GpgSig
  mergetag [Tag]
  other [String]
}

As JSON, real data would look something like:

{
  "author": {
    "date": "1503667703",
    "timezone": "+0200",
    "email": "author@mail",
    "name": "Author Name"
  },
  "committer": {
    "date": "1503667703",
    "timezone": "+0200",
    "email": "author@mail",
    "name": "Author Name"
  },
  "message": "Commit Message\n",
  "parents": [
    <LINK>, <LINK>, ...
  ],
  "tree": <LINK>
}

Tag

type Tag struct {
  object &Any
  type String
  tag String
  tagger PersonInfo
  message String
}

As JSON, real data would look something like:

{
  "message": "message\n",
  "object": {
    "/": "baf4bcfg3mbz3yj3njqyr3ifdaqyfv3prei6h6bq"
  },
  "tag": "tagname",
  "tagger": {
    "date": "1503667703 +0200",
    "email": "author@mail",
    "name": "Author Name"
  },
  "type": "commit"
}

Tree

type Tree {String:TreeEntry}

type TreeEntry struct {
  mode String
  hash &Any
}

As JSON, real data would look something like:

{
  "file.name": {
    "mode": "100664",
    "hash": <LINK>
  },
  "directoryname": {
    "mode": "40000",
    "hash": <LINK>
  },
  ...
}

Blob

type Blob bytes

As JSON, real data would look something like:

"<base64 of 'blob <size>\0<data>'>"

Lead Maintainers

Contribute

PRs are welcome!

Small note: If editing the Readme, please conform to the standard-readme specification.

License

MIT © Jeromy Johnson