From: Jeff Hostetler <jeffhost@xxxxxxxxxxxxx> Signed-off-by: Jeff Hostetler <jeffhost@xxxxxxxxxxxxx> --- t/t5317-pack-objects-blob-filtering.sh | 68 ++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 t/t5317-pack-objects-blob-filtering.sh diff --git a/t/t5317-pack-objects-blob-filtering.sh b/t/t5317-pack-objects-blob-filtering.sh new file mode 100644 index 0000000..58124ab --- /dev/null +++ b/t/t5317-pack-objects-blob-filtering.sh @@ -0,0 +1,68 @@ +#!/bin/sh + +test_description='pack-objects blob filtering' + +. ./test-lib.sh + +test_expect_success setup ' + printf "%10s" X >x10.txt && + printf "%100s" X >x100.txt && + printf "%1000s" X >x1000.txt && + git add *.txt && + git commit -m txt +' + +test_expect_success 'all blobs' ' + test_when_finished "rm -f *.pack *.idx" && + git pack-objects --revs --thin --stdout >z.pack <<-EOF && + master + + EOF + git index-pack z.pack && + test 3 = $(git verify-pack -v z.pack | grep blob | wc -l) +' + +test_expect_success 'no blobs (max equals 0)' ' + test_when_finished "rm -f *.pack *.idx" && + git pack-objects --revs --thin --stdout --max-blob-size=0 >z.pack <<-EOF && + master + + EOF + git index-pack z.pack && + test 0 = $(git verify-pack -v z.pack | grep blob | wc -l) +' + +test_expect_success 'small 20 blobs' ' + test_when_finished "rm -f *.pack *.idx" && + git pack-objects --revs --thin --stdout --max-blob-size=20 >z.pack <<-EOF && + master + + EOF + git index-pack z.pack && + test 1 = $(git verify-pack -v z.pack | grep blob | wc -l) +' + +test_expect_success 'small 200 blobs' ' + test_when_finished "rm -f *.pack *.idx" && + git pack-objects --revs --thin --stdout --max-blob-size=200 >z.pack <<-EOF && + master + + EOF + git index-pack z.pack && + test 2 = $(git verify-pack -v z.pack | grep blob | wc -l) +' + +test_expect_success 'special files always present' ' + test_when_finished "rm -f *.pack *.idx" && + cp x1000.txt .gitignore && + git add .gitignore && + git commit -m "add ignores" && + git pack-objects --revs --stdout --max-blob-size=0 >z.pack <<-EOF && + master + + EOF + git index-pack z.pack && + test 1 = $(git verify-pack -v z.pack | grep blob | wc -l) +' + +test_done -- 2.9.3