Xgit v0.5.0 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
run(content, opts \\ [])
View Sourcerun(content :: Xgit.Core.ContentSource.t(), type: Xgit.Core.ObjectType.t(), validate?: boolean(), repo: Xgit.Repository.t(), write?: boolean() ) :: {:ok, Xgit.Core.ObjectId.t()} | {:error, reason :: Xgit.Core.Object.check_reason()} | {:error, reason :: Xgit.Core.FilePath.check_path_reason()} | {:error, reason :: Xgit.Core.FilePath.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
- 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 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: