From 56eceb1ef24977bb2318c220b2c8ad6e941186ff Mon Sep 17 00:00:00 2001
From: Hannes Mehnert <hannes@mehnert.org>
Date: Wed, 27 Nov 2024 19:45:56 +0100
Subject: [PATCH] add function: commit : t -> Digestif.SHA1.t option

---
 src/git_kv.ml  | 2 ++
 src/git_kv.mli | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/src/git_kv.ml b/src/git_kv.ml
index ef8d57c..8aada58 100644
--- a/src/git_kv.ml
+++ b/src/git_kv.ml
@@ -109,6 +109,8 @@ let connect ctx endpoint =
 
 let branch t = t.branch
 
+let commit t = t.head
+
 type key = Mirage_kv.Key.t
 
 type change = [
diff --git a/src/git_kv.mli b/src/git_kv.mli
index 3655b2c..3de53d7 100644
--- a/src/git_kv.mli
+++ b/src/git_kv.mli
@@ -43,6 +43,9 @@ val connect : Mimic.ctx -> string -> t Lwt.t
 val branch : t -> Git.Reference.t
 (** [branch t] returns the branch used by the given [t]. *)
 
+val commit : t -> Digestif.SHA1.t option
+(** [commit t] returns the commit used by the given [t]. *)
+
 val to_octets : ?level:int -> t -> string Lwt_stream.t
 (** [to_octets ?level store] returns a serialized version of the given [store].
     [level] is the {i zlib} level compression used for Git object (between [0]