diff options
-rw-r--r-- | lib/resolvers.ml | 11 |
1 files 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 |