Xgit v0.1.4 Xgit.Plumbing.HashObject View Source

Computes an object ID and optionally writes that into the repository's object store.

Analogous to git hash-object.

Link to this section Summary

Functions

Computes an object ID and optionally writes that into the repository's object store.

Link to this section Functions

Link to this function

run(content, opts \\ [])

View Source
run(content :: Xgit.Core.ContentSource.t(), [
  {:type, Xgit.Core.ObjectType.t() | nil}
]) ::
  {:ok, Xgit.Core.ObjectId.t()}
  | {:error, reason :: Xgit.Core.ValidateObject.check_reason()}
  | {:error, reason :: Xgit.Core.ValidatePath.check_path_reason()}
  | {:error, reason :: Xgit.Core.ValidatePath.check_path_segment_reason()}
  | {:error, reason :: Xgit.Repository.put_loose_object_reason()}

Computes an object ID and optionally writes that into the repository's object store.

Parameters

content describes how this function should obtain the content. (See Xgit.Core.ContentSource.)

Options

:type: the object's type

:validate?: true to verify that the object is valid for :type

:repo: where the content should be stored

:write?: true to write the object into the repository

TO DO: There is no support, at present, for filters as defined in a .gitattributes file. See issue #18.

Return Values

{:ok, object_id} if the object could be validated and assigned an ID.

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