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 <pclo...@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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to