[PATCH] Avoid unnecessarily inflating and interpreting delta

This teaches packed_delta_info() that it only needs to look at
the type of the base object to figure out both type and size of
a deltified object.  This saves quite a many calls to inflate()
when dealing with a deep delta chain.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Junio C Hamano
2005-06-30 17:13:07 -07:00
committed by Linus Torvalds
parent d0efc8a71d
commit c62266f37c
2 changed files with 42 additions and 36 deletions

View File

@ -16,7 +16,8 @@ int main(int argc, char **argv)
usage("git-cat-file [-t | -s | tagname] <sha1>");
if (!strcmp("-t", argv[1]) || !strcmp("-s", argv[1])) {
if (!sha1_object_info(sha1, type, &size)) {
if (!sha1_object_info(sha1, type,
argv[1][1] == 's' ? &size : NULL)) {
switch (argv[1][1]) {
case 't':
printf("%s\n", type);