summaryrefslogtreecommitdiff
path: root/src/object.c
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2011-03-14 00:07:37 +0100
committerVicent Marti <tanoku@gmail.com>2011-03-15 02:56:19 +0200
commitbd1aa741a4e7b2b83991e7bccbfe55960929af9e (patch)
tree18212b9624074e0b267d0b9dcce674937928bc1e /src/object.c
parent7c8a7b91431fc72a17ec579bcbca3a596071eeb1 (diff)
downloadlibgit2-bd1aa741a4e7b2b83991e7bccbfe55960929af9e.tar.gz
git_object_lookup() should also check the type if the object comes from the cache
Diffstat (limited to 'src/object.c')
-rw-r--r--src/object.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/object.c b/src/object.c
index fce99153b..c432c6da0 100644
--- a/src/object.c
+++ b/src/object.c
@@ -276,6 +276,9 @@ int git_object_lookup(git_object **object_out, git_repository *repo, const git_o
object = git_hashtable_lookup(repo->objects, id);
if (object != NULL) {
+ if (type != GIT_OBJ_ANY && type != object->source.raw.type)
+ return GIT_EINVALIDTYPE;
+
*object_out = object;
object->lru = ++repo->lru_counter;
object->can_free = 0;