package git-unix

  1. Overview
  2. Docs

The Reference module, which represents the Git reference.

include Git.Reference.S with module Hash := Hash
type nonrec t = Git.Reference.t
module P : sig ... end
val head : t
val master : t
val is_head : t -> bool
val of_string : string -> t
val to_string : t -> string
val of_path : Git.Path.t -> t
val to_path : t -> Git.Path.t
val pp : t Fmt.t
val compare : t -> t -> int
val hash : t -> int
val equal : t -> t -> bool
module Set : Stdlib.Set.S with type elt = t
module Map : Stdlib.Map.S with type key = t
type head_contents =
  1. | Hash of Hash.t
    (*

    A pointer to an hash.

    *)
  2. | Ref of t
    (*

    A reference which one can point to an other reference or an hash.

    *)

The type of the value of a Git reference.

val pp_head_contents : head_contents Fmt.t

Pretty-printer of head_contents.

val equal_head_contents : head_contents -> head_contents -> bool

equal_head_contents a b implies a = Ref a' and b = Ref b' and Reference.equal a' b' = true or a = Hash a' and b = Hash b' and Hash.equal a' b'.

However, semantically Ref a' could be equal to Hash b' iff Hash b' is come from the reference a'. That means this function does not handle any indirection when it tests your values.

val compare_head_contents : head_contents -> head_contents -> int
module A : sig ... end
module M : sig ... end
module D : sig ... end
module E : sig ... end

The type of error.

val pp_error : error Fmt.t

Pretty-printer of error.

val mem : fs:Fs.t -> root:Fpath.t -> t -> bool Lwt.t

mem ~fs ~root reference is true iff reference can be found in the git repository root. Otherwise, it is false.

val read : fs:Fs.t -> root:Fpath.t -> t -> dtmp:Cstruct.t -> raw:Cstruct.t -> (head_contents, error) Stdlib.result Lwt.t

read ~fs ~root reference dtmp raw is the value of the reference reference (available in the git repository root). dtmp and raw are buffers used by the decoder (respectively for the decoder as an internal buffer and the input buffer).

This function can returns an error.

val write : fs:Fs.t -> root:Fpath.t -> temp_dir:Fpath.t -> ?capacity:int -> raw:Cstruct.t -> t -> head_contents -> (unit, error) Stdlib.result Lwt.t

write ~fs ~root ~raw reference value writes the value value in the mutable representation of the reference in the git repository root. raw is a buffer used by the decoder to keep the input.

This function can returns an error.

val remove : fs:Fs.t -> root:Fpath.t -> t -> (unit, error) Stdlib.result Lwt.t

remove ~root reference removes the reference from the git repository root.

This function can returns an error.

OCaml

Innovation. Community. Security.