summaryrefslogtreecommitdiff
path: root/lib/git_helpers.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/git_helpers.ml')
-rw-r--r--lib/git_helpers.ml13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/git_helpers.ml b/lib/git_helpers.ml
index 845ee6b..317398c 100644
--- a/lib/git_helpers.ml
+++ b/lib/git_helpers.ml
@@ -62,5 +62,16 @@ module Commit = struct
end
module Branch = struct
- let all_branches repo_path = [ "foo"; "bar"; repo_path ]
+ type t = { name : string }
+
+ let all_branches repo_path =
+ let open Lwt_result.Syntax in
+ let* store = Git_unix.Store.v (Fpath.v repo_path) in
+ let open Lwt.Syntax in
+ let* refs = Store.Ref.list store in
+ let branches =
+ (* Filter these references for branches! *)
+ List.map (function _, x -> x |> Store.Hash.to_hex) refs
+ in
+ Lwt_result.return branches
end
Copyright 2019--2025 Marius PETER