[OCaml] Mobile-friendly clone of cgit.
Use Lwt.Syntax.
lib/handlers.ml
@@ -1,10 +1,12 @@
1
Added:
open Lwt.Syntax
2
Added:
1
3
let ogit_root _req = Views.ogit_root () |> Dream_html.respond
2
4
3
5
let repo_summary req =
4
6
let repo_path = Dream.param req "repo_name" in
5
Removed:
let%lwt branches_result = Git_helpers.all_branches repo_path in
6
Removed:
let%lwt commits_result = Git_helpers.latest_commits repo_path 10 in
7
Removed:
match (branches_result, commits_result) with
7
Added:
let* branches = Git_helpers.all_branches repo_path
8
Added:
and* commits = Git_helpers.latest_commits repo_path 10 in
9
Added:
match (branches, commits) with
8
10
| Ok branches, Ok commits ->
9
11
Views.repo_summary repo_path ~branches ~commits |> Dream_html.respond
10
12
| Error msg, _ | _, Error msg -> Views.error_page msg |> Dream_html.respond