Xgit v0.5.0 Xgit.Plumbing.WriteTree View Source

Write the index file as a tree object.

Analogous to git write-tree.

Link to this section Summary

Types

Reason codes that can be returned by run/2.

Functions

Translates the current working tree, as reflected in its index file, to one or more tree objects.

Link to this section Types

Link to this section Functions

Link to this function

run(repository, opts \\ [])

View Source
run(repository :: Xgit.Repository.t(),
  missing_ok?: boolean(),
  prefix: Xgit.Core.FilePath.t()
) :: {:ok, object_id :: Xgit.Core.ObjectId.t()} | {:error, reason :: reason()}

Translates the current working tree, as reflected in its index file, to one or more tree objects.

The working tree must be in a fully-merged state.

Parameters

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

Options

:missing_ok?: true to ignore any objects that are referenced by the index file that are not present in the object database. Normally this would be an error.

:prefix: (Xgit.Core.FilePath) if present, returns the object_id for the tree at the given subdirectory. If not present, writes a tree corresponding to the root. (The entire tree is written in either case.)

Return Value

{:ok, object_id} with the object ID for the tree that was generated. (If the exact tree specified by the index already existed, it will return that existing tree's ID.)

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

{:error, :bare} if repository doesn't have a working tree.

Reason codes may also come from the following functions: