Files
boot/bin/lumppile.ml
2021-07-06 21:43:50 -05:00

31 lines
777 B
OCaml

(* pile of lumps *)
open Lwt.Infix
module Git_store = Irmin_unix.Git.FS.KV(Irmin.Contents.String)
let git_config = Irmin_git.config ~bare:true "./kommpile"
let git_repo = Git_store.Repo.v git_config
let beginning config =
Git_store.Repo.v config >>= Git_store.master
let branch config name =
Git_store.Repo.v config >>= fun repo ->
Git_store.of_branch repo name
let info message = Irmin_unix.info "%s" message
let main =
Git_store.Repo.v git_config >>= Git_store.master >>= fun t ->
(* Set a/b/c to "Hello, Irmin!" *)
Git_store.set_exn t ["a"; "b"; "c"] "Hello, Irmin!" ~info:(info "my first commit") >>= fun () ->
(* Get a/b/c *)
Git_store.get t ["a"; "b"; "c"] >|= fun s ->
assert (s = "Hello, Irmin!")
let () = Lwt_main.run main