Xgit v0.7.1 Xgit.Commit View Source

Represents a git commit object in memory.

Link to this section Summary

Types

Error response codes returned by from_object/1.

t()

This struct describes a single commit object so it can be manipulated in memory.

Functions

Renders a commit structure from an Xgit.Object.

Renders this commit structure into a corresponding Xgit.Object.

Return true if the value is a commit struct that is valid.

Link to this section Types

Link to this type

from_object_reason()

View Source
from_object_reason() :: :not_a_commit | :invalid_commit

Error response codes returned by from_object/1.

Link to this type

t()

View Source
t() :: %Xgit.Commit{
  author: Xgit.PersonIdent.t(),
  committer: Xgit.PersonIdent.t(),
  message: [byte()],
  parents: [Xgit.ObjectId.t()],
  tree: Xgit.ObjectId.t()
}

This struct describes a single commit object so it can be manipulated in memory.

Struct Members

  • :tree: (Xgit.ObjectId) tree referenced by this commit
  • :parents: (list of Xgit.ObjectId) parent(s) of this commit
  • :author: (Xgit.PersonIdent) author of this commit
  • :committer: (Xgit.PersonIdent) committer for this commit
  • :message: (bytelist) user-entered commit message (encoding unspecified)

TO DO: Support signatures and other extensions. https://github.com/elixir-git/xgit/issues/202

Link to this section Functions

Link to this function

from_object(object)

View Source
from_object(object :: Xgit.Object.t()) ::
  {:ok, commit :: t()} | {:error, from_object_reason()}

Renders a commit structure from an Xgit.Object.

Return Values

{:ok, commit} if the object contains a valid commit object.

{:error, :not_a_commit} if the object contains an object of a different type.

{:error, :invalid_commit} if the object says that is of type commit, but can not be parsed as such.

Link to this function

to_object(commit)

View Source
to_object(commit :: t()) :: Xgit.Object.t()

Renders this commit structure into a corresponding Xgit.Object.

If duplicate parents are detected, they will be silently de-duplicated.

If the commit structure is not valid, will raise ArgumentError.

Link to this function

valid?(commit)

View Source
valid?(commit :: any()) :: boolean()

Return true if the value is a commit struct that is valid.