Xgit v0.1.0 Xgit.Plumbing.HashObject
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
run(content, opts \\ [])
run(content :: Xgit.Core.ContentSource.t(), [
{:type, Xgit.Core.ObjectType.t() | nil}
]) :: {:ok, ObjectID.t()} | {:error, reason :: String.t()}
run(content :: Xgit.Core.ContentSource.t(), [ {:type, Xgit.Core.ObjectType.t() | nil} ]) :: {:ok, ObjectID.t()} | {:error, reason :: String.t()}
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
- Type:
Xgit.Core.ObjectType
- Default:
:blob
- See
-t
option ongit hash-object
.
:validate?
: true
to verify that the object is valid for :type
- Type: boolean
- Default:
true
- This is the inverse of the
--literally
option ongit hash-object
.
:repo
: where the content should be stored
- Type:
Xgit.Repository
(PID) - Default:
nil
:write?
: true
to write the object into the repository
- Type: boolean
- Default:
false
- This option is meaningless if
:repo
is not specified. - See
-w
option ongit hash-object
.
TO DO: There is no support, at present, for filters as defined in a
.gitattributes
file. See issue #18.
Return Value
{:ok, object_id}
if the object could be validated and assigned an ID.
{:error, "reason"}
if unable.