ssb-git

logic for working with git-ssb repos

Usage no npm install needed!

<script type="module">
  import ssbGit from 'https://cdn.skypack.dev/ssb-git';
</script>

README

ssb-git

Functions for working with git-ssb messages.

API

var ssbGit = require('ssb-git')

mergeUpdates

var mergeUpdates = ssbGit.merge
var KVGraph = require('kvgraph')

mergeUpdates is a reduce function, for use with kvgraph's reduceRight function. The state reduced is as follows:

{
  refs: [{name: ref, hash: string, link: Msg, title: string},
  refUpdates: {<ref>: integer},
}
  • refs: list of current refs and their values
  • refUpdates: index in refs of which refs are updated. index is -1 if the ref is deleted.
  • head: ref name for symbolic ref HEAD (the repo's default branch)

linearize

var linearize = ssbGit.linearize

Use this with kvgraph's reduceLeft function to get an array of the updates to a repo.

License

Copyright (c) 2016 Charles Lehner

Usage of the works is permitted provided that this instrument is retained with the works, so that any entity that uses the works is notified of this instrument.

DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.