There seems to be mishandling of the configuration values on the Irmin_fs_unix backend. In the lwt world, this was all handled directly via Irmin_fs.config root which set the root directory to root. Now, there is an indirection via Irmin_fs_unix.config ~path ~clock which sets up the Eio capabilities, but the root will default to ..
Unfortunately, this then breaks the file path handling inside the abstract Irmin_fs module, in particular, when listing directories. I think the following program would be very reasonable for someone to write, setting irmin-fs to use "irmin_example".
module Store = Irmin_fs_unix.KV.Make (Irmin.Contents.String)
let info () = Irmin.Info.Default.v ~message:"Commit" (Mtime_clock.now_ns ())
let main env =
let conf = Irmin_fs_unix.conf ~path:Eio.Path.(env#fs / "irmin_example") ~clock:env#clock in
let repo = Store.Repo.v conf in
let main = Store.main repo in
Store.set_exn ~info main [ "a" ] "hello";
let b1 = Store.of_branch repo "exp1" in
Store.set_exn ~info b1 [ "a" ] "world";
let branches = Store.Branch.list repo in
Eio.traceln "Branches: [%a]\n%!" Fmt.(list ~sep:(Fmt.any ", ") string) branches
let () =
Eio_main.run main
Which has the following output:
$ dune exec -- example/main.exe
+Branches: [xample/./refs/exp1, xample/./refs/main]
A small change is needed to get this working with this example in setting up the configuration.
let conf_unix = Irmin_fs_unix.conf ~path:env#fs ~clock:env#clock in
let conf_fs = Irmin_fs.config "irmin_example" in
let conf = Irmin.Backend.Conf.union conf_unix conf_fs in
...
I do not think this is very desirable. Instead, I think some more serious path hygiene is needed in Irmin_fs (or Irmin_fs_unix).
There seems to be mishandling of the configuration values on the
Irmin_fs_unixbackend. In thelwtworld, this was all handled directly viaIrmin_fs.config rootwhich set the root directory toroot. Now, there is an indirection viaIrmin_fs_unix.config ~path ~clockwhich sets up the Eio capabilities, but therootwill default to..Unfortunately, this then breaks the file path handling inside the abstract
Irmin_fsmodule, in particular, when listing directories. I think the following program would be very reasonable for someone to write, settingirmin-fsto use"irmin_example".Which has the following output:
$ dune exec -- example/main.exe +Branches: [xample/./refs/exp1, xample/./refs/main]A small change is needed to get this working with this example in setting up the configuration.
I do not think this is very desirable. Instead, I think some more serious path hygiene is needed in
Irmin_fs(orIrmin_fs_unix).