package git

  1. Overview
  2. Docs
Module type
Class type

The functor to make the OCaml representation of the Git object by a specific hash implementation, an S.INFLATE implementation for the decompression and a S.DEFLATE implementation for the compression.

The constraints on git objects can cut the path to let the user to make the value module and keep the structural equality. If the Hash module is the same. That means:

```ocaml module V1 = Value.Make(SHA1)(C_inflate)(C_deflate) module V2 = Value.Make(SHA1)(OCaml_inflate)(OCaml_deflate) ```

Types V1.t and V2.t are equal.


module Hash : sig ... end


type hash = Hash.t
type nonrec t = hash t

OCaml value which represents a Git object.

module Blob : Blob.S with type hash = hash
module Commit : Commit.S with type hash = hash
module Tree : Tree.S with type hash = hash
module Tag : Tag.S with type hash = hash
val blob : Blob.t -> t
val commit : Commit.t -> t
val tree : Tree.t -> t
val tag : Tag.t -> t
val kind : t -> [ `Commit | `Blob | `Tree | `Tag ]

kind o returns the kind of the Git object.

val format : t Encore.t
val digest : t -> hash

digest t associates a hash to any value of t. It is guaranteed that if x = y or compare x y = 0, then digest x = digest y.

val pp : t Fmt.t

Pretty-printer of t.

val compare : t -> t -> int

The comparison function for t.

val hash : t -> int

hash blob associates a non-negative integer to any value of t. It is guaranteed that if x = y or compare x y = 0, then hash x = hash y.

val equal : t -> t -> bool

The equal function for t.

Sets and Maps.

module Set : Stdlib.Set.S with type elt = t
module Map : Stdlib.Map.S with type key = t
val length : t -> int64
val to_raw : t -> string
val to_raw_without_header : t -> string
val of_raw_with_header : ?off:int -> ?len:int -> string -> (t, [> `Msg of string ]) Stdlib.result
val of_raw : kind:[ `Commit | `Blob | `Tree | `Tag ] -> Cstruct.t -> (t, [> `Msg of string ]) Stdlib.result
val stream : t -> unit -> string option Lwt.t

Innovation. Community. Security.