Merge pull request 'Add a boot argument to ignore the local git state' (#21) from ignore-local-git into main

Reviewed-on: https://git.robur.io/robur/opam-mirror/pulls/21
This commit is contained in:
Hannes Mehnert 2022-10-26 16:33:25 +00:00
commit 062f4d048d
2 changed files with 12 additions and 2 deletions

View file

@ -60,11 +60,18 @@ let sectors_git =
let doc = Key.Arg.info ~doc ["sectors-git"] in
Key.(create "sectors-git" Arg.(opt int64 Int64.(mul 40L (mul 2L 1024L)) doc))
let ignore_local_git =
let doc = "Ignore restoring locally saved git repository." in
let doc = Key.Arg.info ~doc ["ignore-local-git"] in
Key.(create "ignore-local-git" Arg.(flag doc))
let mirror =
foreign "Unikernel.Make"
~keys:[ Key.v check ; Key.v verify ; Key.v remote ;
Key.v parallel_downloads ; Key.v hook_url ; Key.v tls_authenticator ;
Key.v port ; Key.v sectors_cache ; Key.v sectors_git ; ]
Key.v port ; Key.v sectors_cache ; Key.v sectors_git ;
Key.v ignore_local_git ;
]
~packages:[
package ~min:"0.3.0" ~sublibs:[ "mirage" ] "paf" ;
package "h2" ;

View file

@ -796,7 +796,10 @@ stamp: %S
Lwt.return_unit
else
begin
restore_git git_dump git_ctx >>= function
(if Key_gen.ignore_local_git () then
Lwt.return (Error ())
else
restore_git git_dump git_ctx) >>= function
| Ok git_kv -> Lwt.return git_kv
| Error () ->
Git_kv.connect git_ctx (Key_gen.remote ()) >>= fun git_kv ->