Subject: [PATCH 03/17] fixup! pack-objects: support writing pack v4

From: Nguyễn Thái Ngọc Duy <[email-masked]>
Date: Sat, 21 Sep 2013 20:57:49 +0700

In pack v4, commits should be forced to be loaded in canonical format
too (iow. deltified commits are flattened by read_sha1_file, we don't
care about object_entry->delta).

Signed-off-by: Nguyễn Thái Ngọc Duy <[email-masked]>
---
 builtin/pack-objects.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 6d3c1c8..30559e8 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -260,10 +260,11 @@ static unsigned long write_no_reuse_object(struct sha1file *f, struct object_ent
 
 	if (!usable_delta ||
 	    /*
-	     * Force loading canonical tree. In future we may want to
-	     * read v4 trees directly instead.
+	     * Force loading canonical trees and commits. In future we
+	     * may want to read v4 objects directly instead.
 	     */
-	    (pack_version == 4 && entry->type == OBJ_TREE)) {
+	    (pack_version == 4 && (entry->type == OBJ_TREE ||
+				   entry->type == OBJ_COMMIT))) {
 		if (entry->type == OBJ_BLOB &&
 		    entry->size > big_file_threshold &&
 		    (st = open_istream(entry->idx.sha1, &type, &size, NULL)) != NULL)
-- 
1.8.2.83.gc99314b