From 682de3e8b8786eb2a6b22c02c9c2058553835968 Mon Sep 17 00:00:00 2001 From: Hannes Mehnert Date: Mon, 26 Sep 2022 12:03:12 +0200 Subject: [PATCH] fix search invocation so that something is found --- src/git_kv.ml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/git_kv.ml b/src/git_kv.ml index 687cb9f..75d3e27 100644 --- a/src/git_kv.ml +++ b/src/git_kv.ml @@ -144,10 +144,10 @@ let exists t key = match t.head with | None -> Lwt.return (Ok None) | Some head -> - Search.mem t.store head (`Path (Mirage_kv.Key.segments key)) >>= function + Search.mem t.store head (`Commit (`Path (Mirage_kv.Key.segments key))) >>= function | false -> Lwt.return (Ok None) | true -> - Search.find t.store head (`Path (Mirage_kv.Key.segments key)) + Search.find t.store head (`Commit (`Path (Mirage_kv.Key.segments key))) >|= Option.get >>= Store.read_exn t.store >>= function | Blob _ -> Lwt.return (Ok (Some `Value)) | Tree _ | Commit _ | Tag _ -> Lwt.return (Ok (Some `Dictionary)) @@ -157,7 +157,7 @@ let get t key = match t.head with | None -> Lwt.return (Error (`Not_found key)) | Some head -> - Search.find t.store head (`Path (Mirage_kv.Key.segments key)) >>= function + Search.find t.store head (`Commit (`Path (Mirage_kv.Key.segments key))) >>= function | None -> Lwt.return (Error (`Not_found key)) | Some blob -> Store.read_exn t.store blob >|= function @@ -178,7 +178,7 @@ let list t key = match t.head with | None -> Lwt.return (Error (`Not_found key)) | Some head -> - Search.find t.store head (`Path (Mirage_kv.Key.segments key)) >>= function + Search.find t.store head (`Commit (`Path (Mirage_kv.Key.segments key))) >>= function | None -> Lwt.return (Error (`Not_found key)) | Some tree -> Store.read_exn t.store tree >>= function