Xgit v0.2.5 Xgit.Plumbing.CommitTree View Source

Creates a new commit object based on the provided tree object.

Analogous to git commit-tree.

Link to this section Summary

Types

Reason codes that can be returned by run/2.

Functions

Creates a new commit object based on the provided tree object and parent commits.

Link to this section Types

Link to this type

reason()

View Source
reason() ::
  :invalid_repository
  | :invalid_tree
  | :invalid_parents
  | :invalid_parent_ids
  | :invalid_message
  | :invalid_author
  | :invalid_committer
  | Xgit.Repository.put_loose_object_reason()

Reason codes that can be returned by run/2.

Link to this section Functions

Link to this function

run(repository, opts \\ [])

View Source
run(repository :: Xgit.Repository.t(),
  tree: Xgit.Core.ObjectId.t(),
  parents: [Xgit.Core.ObjectId.t()],
  message: [byte()],
  author: Xgit.Core.PersonIdent.t(),
  committer: Xgit.Core.PersonIdent.t()
) :: {:ok, object_id :: Xgit.Core.ObjectId.t()} | {:error, reason :: reason()}

Creates a new commit object based on the provided tree object and parent commits.

A commit object may have any number of parents. With exactly one parent, it is an ordinary commit. Having more than one parent makes the commit a merge between several lines of history. Initial (root) commits have no parents.

Parameters

repository is the Xgit.Repository (PID) to search for the object.

Options

tree: (Xgit.Core.ObjectId, required) ID of tree object

parents: (list of Xgit.Core.ObjectId) parent commit object IDs

message: (byte list, required) commit message

author: (Xgit.Core.PersonIdent, required) author name, email, timestamp

committer: (Xgit.Core.PersonIdent) committer name, email timestamp (defaults to author if not specified)

Return Value

{:ok, object_id} with the object ID for the commit that was generated.

{:error, :invalid_repository} if repository doesn't represent a valid Xgit.Repository process.

{:error, :invalid_tree} if the :tree option refers to a tree that does not exist.

{:error, :invalid_parents} if the :parents option is not a list.

{:error, :invalid_parent_ids} if the :parents option contains any entries that do not reference valid commit objects.

{:error, :invalid_message} if the :message option isn't a valid byte string.

{:error, :invalid_author} if the :author option isn't a valid PersonIdent struct.

{:error, :invalid_committer} if the :committer option isn't a valid PersonIdent struct.

Reason codes may also come from Xgit.Repository.put_loose_object/2.