From 5e33ec0924d4c13ff1db3c05a0ae732beedfd85a Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Sat, 28 Jun 2025 12:12:04 +0200 Subject: Fix tree view at HEAD. --- lib/resolvers.ml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/resolvers.ml b/lib/resolvers.ml index fb5dee6..fa485e3 100644 --- a/lib/resolvers.ml +++ b/lib/resolvers.ml @@ -126,11 +126,12 @@ module Tree = struct let head repo = let* store = store repo in - let* hash = - Store.Ref.resolve store Git.Reference.head - |> Lwt_result.map Store.Hash.to_hex - in - of_id repo hash + let* commit_hash = Store.Ref.resolve store Git.Reference.head in + Lwt_result.bind (Store.read store commit_hash) @@ function + | Git.Value.Commit commit -> + let tree_id = Store.Value.Commit.tree commit |> Store.Hash.to_hex in + of_id repo tree_id + | _ -> Lwt_result.fail @@ `Msg "HEAD reference does not point to a commit" end module Blob = struct -- cgit v1.2.3