Xgit v0.3.0 Xgit.Plumbing.CatFile.Commit View Source

Retrieves a commit object from a repository's object store.

Analogous to git cat-file -p when the target object is a commit object.

Link to this section Summary

Types

Reason codes that can be returned by run/2.

Functions

Retrieves a commit object from a repository's object store and renders it as an Xgit.Core.Commit struct.

Link to this section Types

Link to this type

reason()

View Source
reason() ::
  :invalid_repository
  | :invalid_object_id
  | Xgit.Repository.get_object_reason()
  | Xgit.Core.Commit.from_object_reason()

Reason codes that can be returned by run/2.

Link to this section Functions

Link to this function

run(repository, object_id)

View Source
run(repository :: Xgit.Repository.t(), object_id :: Xgit.Core.ObjectId.t()) ::
  {:ok, commit :: Xgit.Core.Commit.t()} | {:error, reason :: reason()}

Retrieves a commit object from a repository's object store and renders it as an Xgit.Core.Commit struct.

Parameters

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

object_id is a string identifying the object.

Return Value

{:ok, commit} if the object could be found and understood as a commit. commit is an instance of Xgit.Core.Commit and can be used to retrieve references to the members of that commit.

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

{:error, :invalid_object_id} if object_id can't be parsed as a valid git object ID.

{:error, reason} if otherwise unable. The relevant reason codes may come from: