diff options
author | Marius Peter <marius.peter@tutanota.com> | 2025-06-09 18:23:35 +0200 |
---|---|---|
committer | Marius Peter <marius.peter@tutanota.com> | 2025-06-09 18:23:35 +0200 |
commit | 9448056f6bfec9f84a2976fca48a4a0cd5b12fea (patch) | |
tree | 10f0673216cf3ef01d31a67c07e43abb88886fc0 | |
parent | acf181316989cabc6ea16b42537eec8b03257187 (diff) |
Refactor.
-rw-r--r-- | lib/git_presenters.ml | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/git_presenters.ml b/lib/git_presenters.ml index e098ecc..963f1bd 100644 --- a/lib/git_presenters.ml +++ b/lib/git_presenters.ml @@ -117,15 +117,14 @@ let to_blob store hash = Lwt_result.return { content } | _ -> Lwt_result.fail (`Msg "value is not a blob") -let head_tree_id store = - Store.Ref.resolve store Git.Reference.head >>= Store.read store >>= function - | Git.Value.Commit commit -> - Store.Value.Commit.tree commit |> Lwt_result.return - | _ -> `Msg "no head tree id" |> Lwt_result.fail - let head_tree repo = let* store = store repo in - let* hash = head_tree_id store in + let* hash = + Store.Ref.resolve store Git.Reference.head >>= Store.read store >>= function + | Git.Value.Commit commit -> + Store.Value.Commit.tree commit |> Lwt_result.return + | _ -> `Msg "no head tree id" |> Lwt_result.fail + in to_tree store hash let tree_of_id repo id = |