File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,37 @@ $ opam install git
7979
8080Performance is comparable to the Git tool.
8181
82+ ### Example
83+
84+ ``` ocaml
85+ # require "git.unix";;
86+ # open Lwt.Infix;;
87+ # open Git_unix;;
88+ # module Search = Git.Search(FS);;
89+
90+ # let read file =
91+ FS.create () >>= fun t ->
92+ FS.read_reference_exn t Git.Reference.master >>= fun head ->
93+ Search.find t (Git.SHA.of_commit head) (`Commit (`Path file)) >>= function
94+ | None -> failwith "file not found"
95+ | Some sha -> FS.read_exn t sha >>= function
96+ | Git.Value.Blob b -> Lwt.return (Git.Blob.to_raw b)
97+ | _ -> failwith "not a valid path"
98+ ;;
99+ val read : string list -> string Lwt.t = <fun>
100+
101+ # Lwt_main.run (read ["README.md"] >|= print_string)
102+
103+ Pure OCaml low-level bindings to Git -- Guaranteed no C inside.
104+
105+ Support for on-disk and in-memory Git stores. Can read and write all
106+ the Git objects: the usual blobs, trees, commits and tags but also
107+ the pack files, pack indexes and the index file (where the staging area
108+ lives).
109+
110+ [...]
111+ ```
112+
82113### License
83114
84115MIT, see LICENSE file for its text.
You can’t perform that action at this time.
0 commit comments