aboutsummaryrefslogtreecommitdiff
path: root/cat-file.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-06-30 17:13:07 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-30 22:33:47 -0700
commitc62266f37c677c1de7415ac6cf1e2eb6726590e1 (patch)
tree995538e5c635827aee1075b62d8d5b61899bbdb0 /cat-file.c
parentd0efc8a71da1855c705fd2074b219bcb158b6dbd (diff)
downloadgit-c62266f37c677c1de7415ac6cf1e2eb6726590e1.tar.gz
git-c62266f37c677c1de7415ac6cf1e2eb6726590e1.tar.xz
[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>
Diffstat (limited to 'cat-file.c')
-rw-r--r--cat-file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/cat-file.c b/cat-file.c
index 85a5d4cae..fa0bb722a 100644
--- a/cat-file.c
+++ b/cat-file.c
@@ -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);