Xgit v0.2.5 Xgit.Core.ObjectId View Source
An object ID is a string that identifies an object within a repository.
This string must match the format for a SHA-1 hash (i.e. 40 characters of lowercase hex).
Link to this section Summary
Functions
Assign an object ID for a given data blob.
Read an object ID from raw binary or bytelist.
Read an object ID from a hex string (charlist).
Convert an object ID to raw binary representation.
Returns true
if the value is a valid object ID.
Get the special all-null object ID, often used to stand-in for no object.
Link to this section Types
A string containing 40 bytes of lowercase hex digits.
Link to this section Functions
calculate_id(data, type)
View Sourcecalculate_id( data :: Xgit.Core.ContentSource.t(), type :: Xgit.Core.ObjectType.t() ) :: t()
Assign an object ID for a given data blob.
No validation is performed on the content.
Parameters
data
describes how to read the data. (SeeXgit.Core.ContentSource
.)type
is the intended git object type for this data. (SeeXgit.Core.ObjectType
.)
Return Value
The object ID. (See Xgit.Core.ObjectId
.)
Read an object ID from raw binary or bytelist.
Parameters
raw_object_id
should be either a binary or list containing a raw object ID (not
hex-encoded). It should be exactly 20 bytes.
Return Value
The object ID rendered as lowercase hex. (See Xgit.Core.ObjectId
.)
Read an object ID from a hex string (charlist).
Return Value
If a valid ID is found, returns {id, next}
where id
is the matched ID
as a string and next
is the remainder of the charlist after the matched ID.
If no such ID is found, returns false
.
Convert an object ID to raw binary representation.
Return Value
A 20-byte binary encoding the object ID.
Returns true
if the value is a valid object ID.
(In other words, is it a string containing 40 characters of lowercase hex?)
Get the special all-null object ID, often used to stand-in for no object.