package git
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=b148810ea65aef76503a0fd5deb351fa7307fd29f06ce93fdf43cc7add5c1b45
sha512=73e0a7ab2bf00102653ac14d47ac62f3dddcdb0e24f7c5e33226801331cf608bcbfba2f058b5cb612ba9313d6ab12b2d01556169239e5fb18ef1c14a9b1c1eaf
doc/git/Git/module-type-S/index.html
Module type Git.SSource
type error = private [> | `Not_found of hash| `Reference_not_found of Reference.t| `Msg of string
]dotgit state returns the current ".git" path used - eg. the default ?dotgit value of v if the client does not notice a specific value.
root state returns the current path of the repository. eg. the default value ?root value of v if the client does not notice a specific value.
contents state returns an associated list between the hash and its bind git object. This list contains all git objects available in the current git repository state.
size state hash returns the size of the git object which respects the predicate digest(object) = hash. The size is how many byte(s) are needed to store the serialized (but not deflated) git object in bytes (without the header).
read state hash can retrieve a git object from the current repository state. It de-serializes the git object to an OCaml value.
read_exn state hash is an alias of read but raise an exception (instead to return a result) if the git object requested does not exist or when we catch any others errors.
mem state hash checks if one object satisfies the predicate digest(object) = hash.
list state lists all git objects available in the current git repository state.
write state v writes the value v in the git repository state.
val batch_write :
t ->
hash ->
pck:(unit -> string option Lwt.t) ->
idx:(unit -> string option Lwt.t) ->
(unit, error) result Lwt.tbatch_write state map pack index writes all objects indexed into index and available into pack in the git repository state.
val fold :
t ->
('acc -> ?name:Fpath.t -> length:int64 -> hash -> Value.t -> 'acc Lwt.t) ->
path:Fpath.t ->
'acc ->
hash ->
'acc Lwt.tfold state f ~path acc hash iters on any git objects reachable by the git object hash which located in path (for example, if you iter on a commit, path should be "." - however, if you iter on a tree, path should be the directory path represented by your tree). For each git objects, we notice the path name (derived from path) if the object is a Blob or a Tree, the length or the git object (see size), the hash and the value.
If the hash points to:
Value.Blob.t:fis called only one time with the OCaml value of the blob.Value.Tree.t:fis called firstly with the Ocaml value of the pointed tree by the hashhash. Then, we iter (and callffor each iteration) in the list of entries of the tree. Finally, we retrieve recursively all sub-tree objects and do an ascending walk.fis never called more than one time for each hash.Value.Commit.t:fis called firstly with the OCaml value of the pointed commit by the hashhash. Then, it follozs recursively all parents of the current commit, Finallym it starts afoldinside the pointed root tree git object of each commit previously retrieved.fnever called more than one time for each hash.Value.Tag.t:fis called firstly with the OCaml value of the pointed tag by the hashhash. Then, it follows the git object pointed by the tag.
Any retrieved error is missed.
reset t removes all things of the git repository t and ensures it will be empty.
val read_inflated :
t ->
hash ->
([ `Commit | `Tag | `Blob | `Tree ] * Cstruct.t) option Lwt.tread_inflated state hash returns the inflated git object which respect the predicate digest(value) = hash. We return the kind of the object and the inflated value as a Cstruct.t (which the client can take the ownership).
write_inflated state kind raw writes the git object in the git repository state and associates the kind to this object. This function does not verify if the raw data is well-defined (and respects the Git format). Then, this function returns the hash produced from the kind and the inflated raw to let the user to retrieve it.