Xgit v0.7.0 Xgit.Tree View Source

Represents a git tree object in memory.

Link to this section Summary

Types

Error response codes returned by from_object/1.

t()

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

Functions

Renders a tree structure from an Xgit.Object.

Renders this tree structure into a corresponding Xgit.Object.

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

Link to this section Types

Link to this type

from_object_reason()

View Source
from_object_reason() :: :not_a_tree | :invalid_format | :invalid_tree

Error response codes returned by from_object/1.

Link to this type

t()

View Source
t() :: %Xgit.Tree{entries: [Xgit.Tree.Entry.t()]}

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

Struct Members

  • :entries: list of Tree.Entry structs, which must be sorted by name

Link to this section Functions

Link to this function

from_object(object)

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

Renders a tree structure from an Xgit.Object.

Return Values

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

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

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

{:error, :invalid_tree} if the object can be parsed as a tree, but the entries are not well formed or not properly sorted.

Link to this function

to_object(tree)

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

Renders this tree structure into a corresponding Xgit.Object.

Link to this function

valid?(tree)

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

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

All of the following must be true for this to occur:

  • The value is a Tree struct.
  • The entries are properly sorted.
  • All entries are valid, as determined by Xgit.Tree.Entry.valid?/1.