[PATCH 16/17] pack-objects: disable pack size limit feature on pack v4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



pack v4 format does not go along well with pack size limit feature. v4
requires to know the number of objects in the pack in advance in order
to contruct various tables after pack header. When pack size is
limited, we don't know this number until we write objects out and hit
it. By then the only option we have is rewrite the pack and update the
tables.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
---
 builtin/pack-objects.c | 2 ++
 t/t5300-pack-object.sh | 8 ++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 01954cb..3fd761a 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -2804,6 +2804,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
 		warning("minimum pack size limit is 1 MiB");
 		pack_size_limit = 1024*1024;
 	}
+	if (pack_size_limit && pack_version >= 4)
+		die("pack size limiting is not supported with pack version 4");
 
 	if (!pack_to_stdout && thin)
 		die("--thin cannot be used to build an indexable pack.");
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index 62fc997..831ab79 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -385,9 +385,9 @@ test_expect_success 'index-pack with --strict' '
 	)
 '
 
-test_expect_success 'honor pack.packSizeLimit' '
+test_expect_success 'honor pack.packSizeLimit (pack v2)' '
 	git config pack.packSizeLimit 3m &&
-	packname_10=$(git pack-objects test-10 <obj-list) &&
+	packname_10=$(git pack-objects --version=2 test-10 <obj-list) &&
 	test 2 = $(ls test-10-*.pack | wc -l)
 '
 
@@ -395,9 +395,9 @@ test_expect_success 'verify resulting packs' '
 	git verify-pack test-10-*.pack
 '
 
-test_expect_success 'tolerate packsizelimit smaller than biggest object' '
+test_expect_success 'tolerate packsizelimit smaller than biggest object (pack v2)' '
 	git config pack.packSizeLimit 1 &&
-	packname_11=$(git pack-objects test-11 <obj-list) &&
+	packname_11=$(git pack-objects --version=2 test-11 <obj-list) &&
 	test 5 = $(ls test-11-*.pack | wc -l)
 '
 
-- 
1.8.2.83.gc99314b

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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]