We, the ocaml-git
team, are happy to announce a new major release of ocaml-git v3.0
and related libraries.
Release Notes
OCaml-Git v3.0
OCaml-Git is a library that implements git
format and protocol implementation in pure OCaml. The library is used by libraries such as irmin
, a git-like distributed database, or pasteur
, a MirageOS unikernel-based snippet storage service.
Changes
The main goal behind this major release was to get better compatibility with various platforms, including MirageOS
, 32-bit platforms, and js_of_ocaml
. In order to achieve that, we broke down ocaml-git
into several components, which are represented as sub-libraries. We will describe some of those components later in this post.
Along with better support for various platforms, ocaml-git 3.0
also comes with SSH support for fetch/push
and various bug fixes.
The rest of the changes are mostly internal and pave a way for interesting features such as a full-blown git
garbage collector and wire protocol v2 (announcment and spec).
References:
- Full changes list
-
PR that introduced the major rewrite of
ocaml-git
In the new version of ocaml-git
, we try to have better separation of concerns by breaking some of the ocaml-git
components into sub-libraries, which do not contain git
-specific logic and can be reused for other purposes.
Carton
Git uses PACK files to store old git objects such as commits and transfer objects over wire using git’s wire protocols (git-nss
library mentioned below implements v1 of the protocol; v2 implementation is in progress).
Carton is a library to work with PACK files. The library does not contain git-specific code, so one can easily reuse the library and PACK format for non-git objects. One can see how ocaml-git
uses carton
for its purposes here.
References:
-
PR that introduces
carton
Git-NSS (Not So Smart)
When one wants to synchronize with a remote repository using git, they need to use git fetch/push
. Communication and synchronization/negotiation is defined by git wire protocol, which has two versions: older version 1 and newer leaner version 2. The protocols are defined for four wire transports: HTTP(S), SSH, and git://
(TCP).
Not-So-Smart
library is a library that allows for such synchronization based on the git wire protocols but without git-specific code, meaning that files being fetched do not need to be git objects or that there is no assumptions on the “repository” that one is synchronizing with. So, as well as carton
, the library aims to be reusable for other purposes.
This release features support for SSH using awa-ssh by @hannesm (see the release), support for partial-clone (of various depth
), and memory consumption fixes for unikernels.
Note 1: The library’s name “Not so smart” is a play on the git’s “smart” protocol, a part of wire protocol v1 over HTTP(S) transport.
Note 2: only client side logic is implemented for wire protocols. The server-side is planned but not yet implemented. One can use git
as the server for now.
Mimic
Mimic is a small reimplementation of conduit
, a library that helps to abstract over a transport protocol such as HTTP(S) or SSH. In other words, the code using mimic
can deal not with different types that represent an HTTP or SSH connection, but just deal, e.g., read from or write to, with a flow
value, which hides protocol-specific details under its hood.
There are several independent libraries that were upgraded along with ocaml-git 3.0
.
Duff v0.3
Duff is a library that implements git’s libXdiff
(xdiff
algorithm) in OCaml. PACK files use a binary diff algorithm, xdiff
, to compress binary data. More on the project page and release notes for ocaml-git 2.0
.
Changes
This release fixes the support for 32-bit architecture platforms.
Encore v0.7
Encore is a library that can create an encoder/decoder based on the format given. It also ensures isomorphism by construction.
Changes
Extensive changes to the API. See the project page.
Decompress v1.2.0
Decompress is an OCaml implementation of certain decompression algorithms such as Zlib
, Gzip
, etc.
Changes
ocaml-git 3.0
uses new version of decompress
with extensive performance improvements documented in Tarides’s blog API changes and performance improvements.
We’d be happy to get your feedback or questions!
OCaml-Git team @ Tarides