summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Peter <marius.peter@tutanota.com>2025-06-28 12:12:04 +0200
committerMarius Peter <marius.peter@tutanota.com>2025-06-28 12:12:04 +0200
commit5e33ec0924d4c13ff1db3c05a0ae732beedfd85a (patch)
treea36c59ce7ee824fedfd7e35efbdc339d278b8a08
parent05797c614c89e30288746fa4939e8dd97a508617 (diff)
Fix tree view at HEAD.
-rw-r--r--lib/resolvers.ml11
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
Copyright 2019--2025 Marius PETER