summaryrefslogtreecommitdiff
path: root/src/object.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-05-02 10:36:58 -0700
committerRussell Belfer <rb@github.com>2013-05-02 10:36:58 -0700
commit0cce210a54b931462c402c1cb79091474d0b8577 (patch)
tree648581f04a197883674ccedb664c689599d1d883 /src/object.c
parentb60d95c714f5e68f07c5251aebbe72ba3ad5806d (diff)
downloadlibgit2-0cce210a54b931462c402c1cb79091474d0b8577.tar.gz
Use assert for peel target type check
Diffstat (limited to 'src/object.c')
-rw-r--r--src/object.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/object.c b/src/object.c
index 43aecf434..a6807f26b 100644
--- a/src/object.c
+++ b/src/object.c
@@ -318,16 +318,11 @@ int git_object_peel(
if (git_object_type(object) == target_type)
return git_object_dup(peeled, (git_object *)object);
- if (target_type != GIT_OBJ_TAG &&
- target_type != GIT_OBJ_COMMIT &&
- target_type != GIT_OBJ_TREE &&
- target_type != GIT_OBJ_BLOB &&
- target_type != GIT_OBJ_ANY) {
-
- giterr_set(GITERR_OBJECT, "Cannot peel to object type %d",
- (int)target_type);
- return GIT_EINVALIDSPEC;
- }
+ assert(target_type == GIT_OBJ_TAG ||
+ target_type == GIT_OBJ_COMMIT ||
+ target_type == GIT_OBJ_TREE ||
+ target_type == GIT_OBJ_BLOB ||
+ target_type == GIT_OBJ_ANY);
source = (git_object *)object;