package git

  1. Overview
  2. Docs
On This Page
  1. Backend Features
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Mem.StoreSource

Sourcemodule Hash : sig ... end
Sourcemodule Inflate = Inflate
Sourcemodule Deflate = Deflate
Sourcemodule Value : Value.S with module Hash := Hash and module Inflate := Inflate and module Deflate := Deflate and module Blob = Blob.Make(Hash) and module Commit = Commit.Make(Hash) and module Tree = Tree.Make(Hash) and module Tag = Tag.Make(Hash) and type t = Value.Make(Hash)(Inflate)(Deflate).t
Sourcemodule Reference : Reference.S with module Hash := Hash
Sourcetype t

The type of the git repository.

Sourcetype error = private [>
  1. | `Not_found
]

The type error.

Sourceval pp_error : error Fmt.t

Pretty-printer of error.

Sourcetype buffer

The type for buffers.

Sourceval default_buffer : unit -> buffer

The default buffer.

Sourceval buffer : ?ztmp:Cstruct.t -> ?etmp:Cstruct.t -> ?dtmp:Cstruct.t -> ?raw:Cstruct.t -> ?window:Inflate.window -> unit -> buffer
Sourceval dotgit : t -> Fpath.t

dotgit state returns the current ".git" path used - eg. the default ?dotgit value of create if the client does not notice a specific value.

Sourceval root : t -> Fpath.t

root state returns the current path of the repository. eg. the default value ?root value of create if the client does not notice a specific value.

Sourceval compression : t -> int

compression state returns the current level of the compression used to write a Git object - eg. the default value ?compression value of create if the client does not notice a specific value.

Sourceval contents : t -> ((Hash.t * Value.t) list, error) result Lwt.t

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.

Sourceval size : t -> Hash.t -> (int64, error) result Lwt.t

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).

Sourceval read : t -> Hash.t -> (Value.t, error) result Lwt.t

read state hash can retrieve a git object from the current repository state. It de-serializes the git object to an OCaml value.

Sourceval read_exn : t -> Hash.t -> Value.t Lwt.t

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.

Sourceval mem : t -> Hash.t -> bool Lwt.t

mem state hash checks if one object satisfies the predicate digest(object) = hash.

Sourceval list : t -> Hash.t list Lwt.t

list state lists all git objects available in the current git repository state.

Sourceval write : t -> Value.t -> (Hash.t * int, error) result Lwt.t

write state v writes the value v in the git repository state.

Sourceval fold : t -> ('acc -> ?name:Path.t -> length:int64 -> Hash.t -> Value.t -> 'acc Lwt.t) -> path:Path.t -> 'acc -> Hash.t -> 'acc 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 hash hash. Then, we iter (and call f 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 hash hash. Then, it follozs recursively all parents of the current commit, Finallym it starts a fold 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 hash hash. Then, it follows the git object pointed by the tag.

Any retrieved error is missed.

Sourceval iter : t -> (Hash.t -> Value.t -> unit Lwt.t) -> Hash.t -> unit Lwt.t
Sourcemodule Pack : sig ... end
Sourcemodule Ref : sig ... end
Sourceval reset : t -> (unit, error) result Lwt.t

reset t removes all things of the git repository t and ensures it will be empty.

Sourceval clear_caches : t -> unit Lwt.t

clear_caches t drops all values stored in the internal caches binded with the git repository t.

Sourceval read_inflated : t -> Hash.t -> ([ `Commit | `Tag | `Blob | `Tree ] * Cstruct.t) option Lwt.t

read_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).

Sourceval write_inflated : t -> kind:[ `Commit | `Tree | `Blob | `Tag ] -> Cstruct.t -> Hash.t Lwt.t

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.

Backend Features

Sourceval has_global_watches : bool
Sourceval has_global_checkout : bool
Sourceval v : ?dotgit:Fpath.t -> ?compression:int -> ?buffer:((buffer -> unit Lwt.t) -> unit Lwt.t) -> Fpath.t -> (t, error) result Lwt.t
OCaml

Innovation. Community. Security.