cat-file: teach --batch to stream blob objects
commit98e2092b5027fde9dbe68cb49a196ad2184c02c3
authorJeff King <peff@peff.net>
Wed, 10 Jul 2013 11:38:24 +0000 (10 07:38 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 11 Jul 2013 17:37:16 +0000 (11 10:37 -0700)
treeeac218bc047ba18cc65d4fee392f0f1d2c3d2fe3
parent03c893cbf9ad2e9a5be43382bcabdb2af2a49a4a
cat-file: teach --batch to stream blob objects

The regular "git cat-file -p" and "git cat-file blob" code
paths already learned to stream large blobs. Let's do the
same here.

Note that this means we look up the type and size before
making a decision of whether to load the object into memory
or stream (just like the "-p" code path does). That can lead
to extra work, but it should be dwarfed by the cost of
actually accessing the object itself. In my measurements,
there was a 1-2% slowdown when using "--batch" on a large
number of objects.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/cat-file.c