diff options
| author | Marius Peter <marius.peter@tutanota.com> | 2025-05-18 19:19:27 +0200 | 
|---|---|---|
| committer | Marius Peter <marius.peter@tutanota.com> | 2025-05-18 19:19:27 +0200 | 
| commit | e457b7a8702ae3672cb65d8b3d394dd112594a89 (patch) | |
| tree | 7d8307afe32945fbcf0db7833ae46927f013e62f /lib | |
| parent | 4ffdeec8803a63703cbc72437b51126db5f3c5bf (diff) | |
Add all_branches function sketch.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/git_helpers.ml | 13 | 
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 | 
