[PATCH 03/12] index-pack: do not allocate buffer for unpacking deltas in the first pass
- From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Date
- Sep 7, 2013, 10:43 UTC
- Message-ID
- <1378550599-25365-4-git-send-email-pclouds@gmail.com>
- In-Reply-To
- <1378550599-25365-1-git-send-email-pclouds@gmail.com>
We do need deltas until the second pass. Allocating a buffer for it then freeing later is wasteful is unnecessary. Make it use fixed_buf (aka large blob code path).
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> --- builtin/index-pack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/builtin/index-pack.c b/builtin/index-pack.c index 5b1395d..a47cc34 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -446,7 +446,8 @@ static void *unpack_entry_data(unsigned long offset, unsigned long size, git_SHA1_Update(&c, hdr, hdrlen); } else sha1 = NULL; - if (type == OBJ_BLOB && size > big_file_threshold) + if (is_delta_type(type) || + (type == OBJ_BLOB && size > big_file_threshold)) buf = fixed_buf; else buf = xmalloc(size);
-- 1.8.2.83.gc99314b