Xgit v0.8.0 Xgit.Ref View Source

A reference is a struct that describes a mutable pointer to a commit or similar object.

A reference is a key-value pair where the key is a name in a specific format (see git check-ref-format) and the value (:target) is either a SHA-1 hash or a reference to another reference key (i.e. ref: (name-of-valid-ref)).

This structure contains the key-value pair and functions to validate both values.

Link to this section Summary

Types

Name of a ref (typically refs/heads/master or similar).

t()

This struct describes a single reference stored or about to be stored in a git repository.

Target for a ref. Can be either an Xgit.ObjectId or a string of the form "ref: refs/...".

Functions

Return true if the struct describes a valid reference.

Return true if the string describes a valid reference name.

Link to this section Types

Name of a ref (typically refs/heads/master or similar).

Link to this type

t()

View Source
t() :: %Xgit.Ref{link_target: name() | nil, name: name(), target: target()}

This struct describes a single reference stored or about to be stored in a git repository.

Struct Members

  • :name: the name of the reference (typically refs/heads/master or similar)
  • :target: the object ID currently marked by this reference or a symbolic link (ref: refs/heads/master or similar) to another reference
  • :link_target: the name of another reference which is targeted by this ref

Target for a ref. Can be either an Xgit.ObjectId or a string of the form "ref: refs/...".

Link to this section Functions

Link to this function

valid?(ref, opts \\ [])

View Source
valid?(ref :: any(), allow_one_level?: boolean(), refspec?: boolean()) ::
  boolean()

Return true if the struct describes a valid reference.

Options

allow_one_level?: Set to true to disregard the rule requiring at least one / in name. (Similar to --allow-onelevel option.)

refspec?: Set to true to allow a single * in the pattern. (Similar to --refspec-pattern option.)

Link to this function

valid_name?(name)

View Source
valid_name?(name :: any()) :: boolean()

Return true if the string describes a valid reference name.