From 16dd83347782faec597075e65141d1cd04844ec4 Mon Sep 17 00:00:00 2001 From: Hannes Mehnert Date: Fri, 29 Nov 2024 13:58:17 +0100 Subject: [PATCH] update to git-kv 0.1.1 -- use val commit :) --- mirage/config.ml | 2 +- mirage/unikernel.ml | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/mirage/config.ml b/mirage/config.ml index 2437bab..663c6b3 100644 --- a/mirage/config.ml +++ b/mirage/config.ml @@ -8,7 +8,7 @@ let mirror = package "h2" ; package "ohex" ; package "httpaf" ; - package ~min:"0.0.5" "git-kv" ; + package ~min:"0.1.1" "git-kv" ; package ~min:"3.10.0" "git-paf" ; package "opam-file-format" ; package ~min:"3.0.0" ~sublibs:[ "gz" ] "tar" ; diff --git a/mirage/unikernel.ml b/mirage/unikernel.ml index bcef75e..2fa71ed 100644 --- a/mirage/unikernel.ml +++ b/mirage/unikernel.ml @@ -697,11 +697,15 @@ module Make Printf.sprintf "%s, %02d %s %04d %02d:%02d:%02d GMT" weekday d m' y hh mm ss let commit_id git_kv = - Store.digest git_kv Mirage_kv.Key.empty >|= fun r -> - Result.fold r ~ok:Ohex.encode - ~error:(fun e -> - Logs.err (fun m -> m "%a" Store.pp_error e); - exit 2) + match Git_kv.commit git_kv with + | Some `Clean hash -> + Ohex.encode (Digestif.SHA1.to_raw_string hash) + | Some `Dirty _ -> + Logs.err (fun m -> m "commit is dirty"); + exit 2 + | None -> + Logs.err (fun m -> m "commit is none"); + exit 2 let repo remote commit = let upstream = List.hd (String.split_on_char '#' remote) in -- 2.47.0