Xgit v0.5.0 Xgit.Plumbing.CatFile.Tree View Source

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

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

Link to this section Summary

Types

Reason codes that can be returned by run/2.

Functions

Retrieves a tree object from a repository's object store and renders it as an Xgit.Core.Tree 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.Tree.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, tree :: Xgit.Core.Tree.t()} | {:error, reason :: reason()}

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

Parameters

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

object_id is a string identifying the object.

Return Value

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

{: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: