Xgit v0.1.6 Xgit.Core.ValidateObject View Source
Verifies that an object is formatted correctly.
Verifications made by this module only check that the fields of an object are formatted correctly. The object ID checksum of the object is not verified, and connectivity links between objects are also not verified. It's assumed that the caller can provide both of these validations on its own.
Link to this section Summary
Functions
Verify that a proposed object is valid.
Link to this section Types
check_reason()
View Sourcecheck_reason() :: :invalid_type | :no_tree_header | :invalid_tree | :invalid_parent | :no_author | :no_committer | :no_object_header | :invalid_object | :no_type_header | :invalid_tagger | :bad_date | :bad_email | :missing_email | :missing_space_before_date | :bad_time_zone | :invalid_file_mode | :truncated_in_name | :duplicate_entry_names | :incorrectly_sorted | :truncated_in_object_id | :null_sha1 | :invalid_mode
Error codes which can be returned by check/2
.
Link to this section Functions
check(object, opts \\ [])
View Sourcecheck(object :: Xgit.Core.Object.t(), opts :: Keyword.t()) :: :ok | {:error, reason :: check_reason()} | {:error, reason :: Xgit.Core.ValidatePath.check_path_reason()} | {:error, reason :: Xgit.Core.ValidatePath.check_path_segment_reason()}
Verify that a proposed object is valid.
This function performs a detailed check on the content of the object.
For a simpler verification that the Xgit.Core.Object
struct is itself
valid, see Xgit.Core.Object.valid?/1
.
Options
By default, this function will only enforce Posix file name restrictions.
:macosx?
:true
to also enforce Mac OS X file name restrictions:windows?
:true
to also enforce Windows file name restrictions
Return Value
:ok
if the object is successfully validated.
{:error, :invalid_type}
if the object's type is unknown.
{:error, :no_tree_header}
if the object is a commit but does not contain
a valid tree header.
{:error, :invalid_tree}
if the object is a commit but the tree object ID
is invalid.
{:error, :invalid_parent}
if the object is a commit but one of the parent
headers is invalid.
{:error, :no_author}
if the object is a commit but there is no author
header.
{:error, :no_committer}
if the object is a commit but there is no committer
header.
{:error, :no_object_header}
if the object is a tag but there is no object
header.
{:error, :invalid_object}
if the object is a tag but the object ID is invalid.
{:error, :no_type_header}
if the object is a tag but there is no type
header.
{:error, :invalid_tagger}
if the object is a tag but one of the tagger
headers
is invalid.
{:error, :bad_date}
if the object is a tag or a commit but has a malformed date entry.
{:error, :bad_email}
if the object is a tag or a commit but has a malformed e-mail address.
{:error, :missing_email}
if the object is a tag or a commit but has a missing e-mail address
where one is expected.
{:error, :missing_space_before_date}
if the object is a tag or a commit but
has no space preceding the place where a date is expected.
{:error, :bad_time_zone}
if the object is a tag or a commit but has a malformed
time zone entry.
{:error, :invalid_file_mode}
if the object is a tree but one of the file modes is invalid.
{:error, :truncated_in_name}
if the object is a tree but one of the file names is incomplete.
{:error, :duplicate_entry_names}
if the object is a tree and contains duplicate
entry names.
{:error, :incorrectly_sorted}
if the object is a tree and the entries are not
in alphabetical order.
{:error, :truncated_in_object_id}
if the object is a tree and one of the object IDs
is invalid.
{:error, :null_sha1}
if the object is a tree and one of the object IDs is all zeros.
{:error, :invalid_mode}
if the object is a tree and one of the file modes is incomplete.
See also error responses from Xgit.Core.ValidatePath.check_path/2
and
Xgit.Core.ValidatePath.check_path_segment/2
.