include Git.Store.S with module Hash = Git.Hash.Make(Digestif.SHA1) and module FS := Fs
module Hash = Git.Hash.Make(Digestif.SHA1)
The Digest
module used to make the implementation.
module Inflate : sig ... end
The Inflate
module used to make the implementation.
module Deflate : sig ... end
The Deflate
module used to make the implementation.
module Value : Git.Value.S with module Hash := Hash and module Inflate := Inflate and module Deflate := Deflate and module Blob = Git.Blob.Make(Hash) and module Commit = Git.Commit.Make(Hash) and module Tree = Git.Tree.Make(Hash) and module Tag = Git.Tag.Make(Hash) and type t = Git.Value.Make(Hash)(Inflate)(Deflate).t
The Value module, which represents the Git object.
The Reference module, which represents the Git reference.
module HDec : Git.Unpack.H with module Hash := Hash
module PDec : Git.Unpack.P with module Hash := Hash and module Inflate := Inflate and module Hunk := HDec
module RPDec : Git.Unpack.D with module Hash := Hash and module Inflate := Inflate and module Hunk := HDec and module Pack := PDec and module Mapper := Fs.Mapper
module IDec : Git.Index_pack.LAZY with module Hash := Hash
module IEnc : Git.Index_pack.ENCODER with module Hash := Hash
module PInfo : Git.Pack_info.S with module Hash := Hash and module Inflate := Inflate and module HDec := HDec and module PDec := PDec
module Packed_refs : Git.Packed_refs.S with module Hash := Hash and module FS := Fs
type error = [
| `Delta of PEnc.Delta.error |
| `Pack_decoder of RPDec.error |
| `Pack_encoder of PEnc.error |
| `Pack_info of PInfo.error |
| `Idx_decoder of IDec.error |
| `Idx_encoder of IEnc.error |
| `Invalid_hash of Hash.t |
| `Invalid_reference of Reference.t |
| Git.Error.Decoder.t |
| Fs.error Git.Error.FS.t |
| Inflate.error Git.Error.Inf.t |
| Deflate.error Git.Error.Def.t |
| Git.Error.not_found |
]
The type error.
module Loose : Git.Store.LOOSE with type t = Value.t and type state = t and type error = error and module Hash := Hash and module Inflate := Inflate and module Deflate := Deflate and module FS := Fs
The Loose
module which represents any loose git object available in git repository.
module Pack : Git.Store.PACK with type t = RPDec.Object.t and type value = Value.t and type state = t and type error = error and module Hash := Hash and module FS := Fs and module Inflate := Inflate and module HDec := HDec and module PDec := PDec and module RPDec := RPDec
The Pack
module which represents any packed git object available in the git repository.
val default_buffer : unit -> buffer
val buffer : ?ztmp:Cstruct.t -> ?etmp:Cstruct.t -> ?dtmp:Cstruct.t -> ?raw:Cstruct.t -> ?window:Inflate.window -> unit -> buffer
Build a buffer to read and write a Git object.
window
is a buffer used by theInflate
moduleztmp
is a buffer used to store the inflated flowdtmp
is a buffer used by the decoder to save the inflated flow (and keep it for an alteration)raw
is a buffer used to store the input flow
If not specified the cstruct are created with a size of 4 MiB.
Store functions can be used in a concurrency context only if the specified buffers are not used by another process. The deserialisation functions does not allocate any buffer and uses only the specified buffers to construct the OCaml value.
val compression : t -> int
compression state
is the current level of the compression used to write a git object.
mem state hash
is true if one object of the current repository state
satisfies the predicate digest(object) = hash
.
list state
is the list of all git objects available in the current repository state
.
read state hash
is the Git object with hash hash
from the current repository state
. It de-serializes the git object to an OCaml value. This function needs some buffers, provided t
's buffer function.
This function follows the same scheme of allocation of Loose.read
if the requested git object is a loose git object or Pack.read
if the requested git object is a packed git object. Otherwise, return an error
.
write state v
writes as a loose git object v
in the file-system. It serializes and deflates the value to a new file. which respect the internal structure of a git repository.
This function does not allocate any buffer and uses only the specified buffers to store the OCaml value to the file-system. Then, the OCaml value will be available by read state digest(v)
. Otherwise, return an error
:
FS
.File.error when we can not create a new file in the file-system.Value.E.error
when we can not serialize xor deflate the requested git loose object. This kind of error should be never happen.
val size : t -> Hash.t -> (int64, error) Stdlib.result Lwt.t
read_inflated state hash
is the non-compressed representaton of a Git object in the git repository xsstate
. However, this function does not de-serialize the git object and returns the kind of the object and the raw-data inflated. Precisely, it decodes only the header.
This function follows the same scheme of allocation of Loose.read_inflated
if the requested git object is a loose git object or Pack.read
if the requested git object is a packed git object. Otherwise, return an error
.
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.
If we retrieve any error error while the I/O operations, we raise 9by Lwt.fail
a Failure
which describe in a string
the error encountered.
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
.
val fold : t -> ('a -> ?name:Git.Path.t -> length:int64 -> Hash.t -> Value.t -> 'a Lwt.t) -> path:Git.Path.t -> 'a -> Hash.t -> 'a Lwt.t
fold 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
:f
is called only one time with the OCaml value of the blob.Value.Tree.t
:f
is called firstly with the Ocaml value of the pointed tree by the hashhash
. Then, we iter (and callf
for each iteration) in the list of entries of the tree. Finally, we retrieve recursively all sub-tree objects and do an ascending walk.f
is never called more than one time for each hash.Value.Commit.t
:f
is 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 afold
inside the pointed root tree git object of each commit previously retrieved.f
never called more than one time for each hash.Value.Tag.t
:f
is 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 skipped.
module Ref : sig ... end
clear_caches t
drops all values stored in the internal caches binded with the git repository t
.
val reset : t -> (unit, error) Stdlib.result Lwt.t
reset t
removes all things of the git repository t
and ensures it will be empty.