Library
Module
Module type
Parameter
Class
Class type
This module implements the ability to manipulate a Git repository as a Key-Value store. It allows you to create a local (in-memory) Git repository that can come from either:
The first case is interesting if you want to be synchronised with the remote repository. The second case can be interesting if we don't want to create a connection at the beginning and desynchronisation between our local and remote repositories is not a problem.
In the second case, the synchronisation can be done later with pull
.
The user can modify the repository (add files, remove files, etc.). Each change produces a commit and after each change we try to transfer them to the remote Git repository. If you want to make multiple changes but contain them in a single commit and only transfer those changes once, you should use the Make.change_and_push
function.
Finally, the KV-store tries to keep the minimal set of commits required between you and the remote repository. Only unpushed changes are kept by the KV-store. However, if these changes are not pushed, they will be stored into the final state produced by to_octets
. In other words, the more changes you make out of sync with the remote repository (without pushing them), the bigger the state serialization will be.
connect ctx remote
creates a new Git store which synchronises with remote
via protocols available into the given ctx
.
val branch : t -> Git.Reference.t
branch t
returns the branch used by the given t
.
val to_octets : ?level:int -> t -> string Lwt_stream.t
to_octets ?level store
returns a serialized version of the given store
. level
is the zlib level compression used for Git object (between 0
and 9
including), defaults to 4
.
val of_octets :
Mimic.ctx ->
remote:string ->
string Lwt_stream.t ->
(t, [> `Msg of string ]) Stdlib.result Lwt.t
pull store
tries to synchronise the remote Git repository with your local store
Git repository. It returns a list of changes between the old state of your store and what you have remotely.