@@ -47,7 +47,7 @@ $ opam install git
4747 position-independent representation so that they can be manipulated
4848 more easily. Pack file can be created but will not be compressed yet.
4949
50- * The [ index file] (http ://mirage. github.io/ ocaml-git/Index.html )
50+ * The [ index file] (https ://github.com/samoht/ ocaml-git/blob/master/lib/index.mli )
5151 (used as for managing the stagging area)
5252 are fully supported. Which means that ` git diff ` and ` git status `
5353 will work as expected on a repository created by the library.
@@ -63,7 +63,7 @@ $ opam install git
6363* An abstraction for Git [ Store] ( http://mirage.github.io/ocaml-git/Store.S.html )
6464 is available. Various store implementations are available:
6565 - An [ in-memory] ( http://mirage.github.io/ocaml-git/Memory.html ) implementation;
66- - A [ unix filesystem] ( http://mirage.github.io/ocaml-git/Git_unix.FS.html )
66+ - A [ unix filesystem] ( http://mirage.github.io/ocaml-git/Git_unix.S. FS.html )
6767 implementation;
6868 - A [ mirageOS] ( http://mirage.github.io/ocaml-git/Git_mirage.html ) implementation,
6969 requiring an ` V1_LWT.FS ` implementation.
@@ -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.
0 commit comments