diff options
author | Vicent Martà <vicent@github.com> | 2013-05-06 06:45:53 -0700 |
---|---|---|
committer | Vicent Martà <vicent@github.com> | 2013-05-06 06:45:53 -0700 |
commit | 03c28d92d00074f1501cb0d7ce9f5e3e0154a244 (patch) | |
tree | 64c394dc10a839fd0766a800ff31a1d0236360d6 /src/object.c | |
parent | d5e5bbd7193924aa845e107f747a15814a679b10 (diff) | |
parent | 6e286e8dc59874db30b6fbb0ca5d32d4a2b5642c (diff) | |
download | libgit2-03c28d92d00074f1501cb0d7ce9f5e3e0154a244.tar.gz |
Merge pull request #1526 from arrbee/cleanup-error-return-without-msg
Make sure error messages are set for most error returns
Diffstat (limited to 'src/object.c')
-rw-r--r-- | src/object.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/object.c b/src/object.c index b87a07404..a6807f26b 100644 --- a/src/object.c +++ b/src/object.c @@ -122,8 +122,10 @@ int git_object_lookup_prefix( assert(repo && object_out && id); - if (len < GIT_OID_MINPREFIXLEN) + if (len < GIT_OID_MINPREFIXLEN) { + giterr_set(GITERR_OBJECT, "Ambiguous lookup - OID prefix is too short"); return GIT_EAMBIGUOUS; + } error = git_repository_odb__weakptr(&odb, repo); if (error < 0) @@ -311,18 +313,17 @@ int git_object_peel( git_object *source, *deref = NULL; int error; - 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) - return GIT_EINVALIDSPEC; - assert(object && peeled); if (git_object_type(object) == target_type) return git_object_dup(peeled, (git_object *)object); + 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; while (!(error = dereference_object(&deref, source))) { |