open Lwt.Infix let get_head_commit_hash repo_path = let full_path = Filename.concat Config.git_directory repo_path in let%lwt store_result = Git_unix.Store.v @@ Fpath.v full_path in match store_result with | Error _ -> Lwt.return_error "Could not open the Git repository." | Ok store -> ( Git_unix.Store.Ref.resolve store Git.Reference.head >|= function | Error _ -> Error ("Failed to resolve HEAD for repo " ^ repo_path) | Ok hash -> Ok (Git_unix.Store.Hash.to_hex hash))