package git

  1. Overview
  2. Docs


include IO

Input/output functions

include S
type t

The type for the given Git object.

val equal : t -> t -> bool

Are two objects equal?

val hash : t -> int

Hash an object.

val compare : t -> t -> int

Compare two objects.

val pp : t Fmt.t

pp is the pretty-printer for values of type t.

val input : Mstruct.t -> t

Build a value from an inflated contents.

val add : Buffer.t -> ?level:int -> t -> unit

Add the serialization of the value to an already existing buffer.

The compression level must be between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time). The default value (currently equivalent to level 6) requests a default compromise between speed and compression.

val to_raw : t -> string
val of_raw : string -> t
module Map : Map.S with type key = t

A map of references.

val head : t

The repository HEAD.

val master : t

The master branch.

val is_head : t -> bool

Is the given reference the HEAD ?

type head_contents =
  1. | Hash of Hash.Commit.t
  2. | Ref of t

    The possible HEAD contents.

val head_contents_of_string : of_hex:(string -> Hash.t) -> string -> head_contents

Parse the contents of HEAD

val head_contents_of_commit : Hash.Commit.t Map.t -> Hash.Commit.t -> head_contents

Build a head contents from a commit hash. The result is either the hex representation of the SHA or something like ref: <ref> if the SHA has already a reference pointing to it.

val pp_head_contents : Format.formatter -> head_contents -> unit

Pretty-print head contents.

val equal_head_contents : head_contents -> head_contents -> bool

Compare head contents.

val is_valid : t -> bool

Check if a reference can be stored on disk properly.


Innovation. Community. Security.