Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com>
---
 by setting usable_delta to zero, I disable tree delta in
 pack-objects. Some test cases spotted this.

 builtin/pack-objects.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 945b817..b60b1a0 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -256,7 +256,12 @@ static unsigned long write_no_reuse_object(struct sha1file 
*f, struct object_ent
        struct git_istream *st = NULL;
        char *result = "OK";
 
-       if (!usable_delta) {
+       if (!usable_delta ||
+           /*
+            * Force loading canonical tree. In future we may want to
+            * read v4 trees directly instead.
+            */
+           (pack_version == 4 && entry->type == OBJ_TREE)) {
                if (entry->type == OBJ_BLOB &&
                    entry->size > big_file_threshold &&
                    (st = open_istream(entry->idx.sha1, &type, &size, NULL)) != 
NULL)
@@ -518,9 +523,6 @@ static unsigned long write_object(struct sha1file *f,
        else
                usable_delta = 0;       /* base could end up in another pack */
 
-       if (pack_version == 4 && entry->type == OBJ_TREE)
-               usable_delta = 0;
-
        if (!reuse_object)
                to_reuse = 0;   /* explicit */
        else if (!entry->in_pack)
-- 
1.8.2.82.gc24b958

--
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