package git

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

The Git Reference module.

type t = private string

A Git Reference object. Which contains a hash to point to an other object.

module P : sig ... end
val head : t

head is the user-friendly value of HEAD Git reference.

val master : t

master is the user-friendly value of refs/heads/master Git reference.

val is_head : t -> bool

is_head t returns true if t = head.

val of_string : string -> t

of_string s returns a valid reference value. A valid value means:

A refname is a hierarchical octet string beginning with "refs/" and not violating the git-check-ref-format command's validation rules. More specifically, they:

  • They can include slash '/' for hierarchical (directory) grouping, but no slash-separated component can begin with a dot '.'.
  • They must contain at least one '/'. This enforces the presence of a category like "heads/", "tags/" etc. but the actual names are not restricted.
  • They cannot have two consecutive dots ".." anywhere.
  • They cannot have ASCII control characters (i.e. bytes whose values are lower than \040 or \177 DEL), space, tilde '~', caret '^', colon ':', question-mark '?', asterisk '*', or open bracket '[' anywhere.
  • They cannot end with a slash '/' or a dot '.'.
  • They cannot end with the sequence ".lock".
  • They cannot contain a sequence "@{".
  • They cannot contain a '\\'.
val to_string : t -> string

to_string t returns the string value of the reference t.

val of_path : Path.t -> t

of_path path casts a path to a reference.

val to_path : t -> Path.t

to_path ref casts a reference ref to a path (as a Window path or Unix path).

module type S = sig ... end

Interface to describe the Git reference value head_contents.

module type IO = sig ... end

The interface which describes any I/O operations on Git reference.

module Make (Hash : sig ... end) : S with module Hash := Hash

The functor to make the OCaml representation of the Git Reference object by a specific hash.

module IO (H : sig ... end) (FS : sig ... end) : IO with module Hash := H and module FS := FS

The functor to make a module which implements I/O operations on references on a file-system.