package git

  1. Overview
  2. Docs

Parameters

module D : DIGEST

Signature

include H with type t = t
include S with type t = t

Signature for hash values

The usual compare functions on hashes, but can raise Ambiguous if one is short hash and is prefix to the other.

include S with type t = t
type t = t

The type for the given Git object.

val to_raw : t -> string

Raw hash value.

val of_raw : string -> t

Abstract a raw hash value.

val to_hex : t -> string

to_hex h is hs' hex encoding.

val hex_length : t -> int

The number of hex digits in the hash.

val lt : t -> t -> bool

(<) relation between hash.

val is_prefix : t -> t -> bool

Check if a hash is a prefix of another hash.

module Set : Set with type elt = t
module Map : Map with type key = t
include IO with type t := t

Input/output functions

include S with type t := t
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 of_hex : string -> t

Convert an hex-encoded string into a hash value. Raise Ambiguous if the hash is short; in that case use of_short_hex.

val of_short_hex : string -> t

Same as of_hex but allow values shorter than 20 characters. Such hash values are called short hashes and can cause some functions to raise Ambiguous.

val input_hex : Mstruct.t -> t

Read an hex-encoded hash value.

val add_hex : Buffer.t -> t -> unit

Add the hex-encoding of the hash value to the buffer.

val is_short : t -> bool

Check if the hash is short.

val zero : t

A hash full of zero. Useful for padding.

module Blob : H with type t = Blob.t
module Tree : H with type t = Tree.t
module Commit : H with type t = Commit.t
OCaml

Innovation. Community. Security.