Persistent store with Git semantics: lazy reads, delayed writes, content-addressing
at main 23 lines 820 B view raw
1(** Init command. *) 2 3open Irmin 4 5let run ~backend path = 6 Eio_main.run @@ fun env -> 7 let fs = Eio.Stdenv.cwd env in 8 Eio.Switch.run @@ fun sw -> 9 let path' = Fpath.v path in 10 match backend with 11 | `Git -> 12 let _store = Git_interop.init_git ~sw ~fs ~path:path' in 13 Common.success "Initialised Git repository at %a" Common.styled_bold path 14 | `Mst -> 15 (* Create .irmin directory with config *) 16 let irmin_dir = Filename.concat path ".irmin" in 17 (try Unix.mkdir irmin_dir 0o755 with Unix.Unix_error _ -> ()); 18 let config_path = Filename.concat irmin_dir "config" in 19 let oc = open_out config_path in 20 output_string oc "backend = mst\n"; 21 output_string oc "branch = main\n"; 22 close_out oc; 23 Common.success "Initialised MST store at %a" Common.styled_bold path