aboutsummaryrefslogtreecommitdiff
path: root/builtin-pack-objects.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-09-03 14:44:46 -0700
committerJunio C Hamano <junkio@cox.net>2006-09-03 14:44:46 -0700
commit7042dbf7a1e9137eb856b3b086a062561c50b8a3 (patch)
tree7471472a2d06e145a6f956aa4eabfc50680ad0f5 /builtin-pack-objects.c
parentdf6d61017a17efe67e4709028fea8e820b5efc5e (diff)
downloadgit-7042dbf7a1e9137eb856b3b086a062561c50b8a3.tar.gz
git-7042dbf7a1e9137eb856b3b086a062561c50b8a3.tar.xz
pack-objects: fix thinko in revalidate code
When revalidating an entry from an existing pack entry->size and entry->type are not necessarily the size of the final object when the entry is deltified, but for base objects they must match. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r--builtin-pack-objects.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 11cc3c89f..5e42387a4 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -247,12 +247,13 @@ static int revalidate_one(struct object_entry *entry,
void *data, char *type, unsigned long size)
{
int err;
- if (!data)
- return -1;
- if (size != entry->size)
- return -1;
- err = check_sha1_signature(entry->sha1, data, size,
- type_names[entry->type]);
+ if ((!data) ||
+ ((entry->type != OBJ_DELTA) &&
+ ( (size != entry->size) ||
+ strcmp(type_names[entry->type], type))))
+ err = -1;
+ else
+ err = check_sha1_signature(entry->sha1, data, size, type);
free(data);
return err;
}