Use assert for peel target type check

This commit is contained in:
Russell Belfer 2013-05-02 10:36:58 -07:00
parent b60d95c714
commit 0cce210a54

View File

@ -318,16 +318,11 @@ int git_object_peel(
if (git_object_type(object) == target_type) if (git_object_type(object) == target_type)
return git_object_dup(peeled, (git_object *)object); return git_object_dup(peeled, (git_object *)object);
if (target_type != GIT_OBJ_TAG && assert(target_type == GIT_OBJ_TAG ||
target_type != GIT_OBJ_COMMIT && target_type == GIT_OBJ_COMMIT ||
target_type != GIT_OBJ_TREE && target_type == GIT_OBJ_TREE ||
target_type != GIT_OBJ_BLOB && target_type == GIT_OBJ_BLOB ||
target_type != GIT_OBJ_ANY) { target_type == GIT_OBJ_ANY);
giterr_set(GITERR_OBJECT, "Cannot peel to object type %d",
(int)target_type);
return GIT_EINVALIDSPEC;
}
source = (git_object *)object; source = (git_object *)object;