type commit_info = { hash : string; message : string option; author : string; date : string; } let full_path path = Filename.concat Config.git_directory path let store repo_path = let path = Fpath.v @@ full_path repo_path in Git_unix.Store.v ~dotgit:path path let latest_commits repo_path ~count = let open Lwt_result.Syntax in let* store_result = store repo_path in let* commits = Git.Commit.Make in commits let all_branches repo_path = let cmd = Printf.sprintf "git -C %s branch --format=%%(refname:short)" @@ full_path repo_path in Lwt.catch (fun () -> let%lwt output = Lwt_process.pread ("", [| "sh"; "-c"; cmd |]) in let branches = String.split_on_char '\n' output |> List.filter (fun s -> String.trim s <> "") in Lwt.return_ok branches) (fun exn -> Lwt.return_error (Printexc.to_string exn))