summaryrefslogtreecommitdiff
path: root/src/object.c
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-05-11 23:56:23 +0200
committernulltoken <emeric.fermas@gmail.com>2012-05-11 23:56:23 +0200
commite28c37761bc8087164e6886f7f267beb1325655f (patch)
tree87096bb9901213985778236d1c16769efd69dbb5 /src/object.c
parentfb49bdf9c7837892154bf7efdb3db6c3ec63e396 (diff)
downloadlibgit2-e28c37761bc8087164e6886f7f267beb1325655f.tar.gz
object: make git_object_lookup() return GIT_ENOTFOUND when searching for an existing object by specifying an incorrect type
This fix complements cb0ce16bbe8efe2098ef9cfffcf158301b036565 and cover the following additional use cases - retrieving an object which has been previously searched, found and cached - retrieving an object through an non ambiguous abbreviated id
Diffstat (limited to 'src/object.c')
-rw-r--r--src/object.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/object.c b/src/object.c
index 02be5dac8..deeacb27c 100644
--- a/src/object.c
+++ b/src/object.c
@@ -109,8 +109,8 @@ int git_object_lookup_prefix(
if (object != NULL) {
if (type != GIT_OBJ_ANY && type != object->type) {
git_object_free(object);
- giterr_set(GITERR_INVALID, "The given type does not match the type in ODB");
- return -1;
+ giterr_set(GITERR_ODB, "The given type does not match the type in ODB");
+ return GIT_ENOTFOUND;
}
*object_out = object;