(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'adding and checking out large blobs'>)} spids: [7] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {<setup>} { (SQ <'\n'> <'\t# clone does not allow us to pass core.bigfilethreshold to\n'> <'\t# new repos, so set core.bigfilethreshold globally\n'> <'\tgit config --global core.bigfilethreshold 200k &&\n'> <'\tprintf "%2000000s" X >large1 &&\n'> <'\tcp large1 large2 &&\n'> <'\tcp large1 large3 &&\n'> <'\tprintf "%2500000s" Y >huge &&\n'> <'\tGIT_ALLOC_LIMIT=1500k &&\n'> <'\texport GIT_ALLOC_LIMIT\n'> ) } ) (C {<test_expect_success>} {(SQ <'add a large file or two'>)} { (SQ <'\n'> <'\tgit add large1 huge large2 &&\n'> <'\t# make sure we got a single packfile and no loose objects\n'> <'\tbad= count=0 idx= &&\n'> <'\tfor p in .git/objects/pack/pack-*.pack\n'> <'\tdo\n'> <'\t\tcount=$(( $count + 1 ))\n'> <'\t\tif test -f "$p" && idx=${p%.pack}.idx && test -f "$idx"\n'> <'\t\tthen\n'> <'\t\t\tcontinue\n'> <'\t\tfi\n'> <'\t\tbad=t\n'> <'\tdone &&\n'> <'\ttest -z "$bad" &&\n'> <'\ttest $count = 1 &&\n'> <'\tcnt=$(git show-index <"$idx" | wc -l) &&\n'> <'\ttest $cnt = 2 &&\n'> <'\tfor l in .git/objects/??/??????????????????????????????????????\n'> <'\tdo\n'> <'\t\ttest -f "$l" || continue\n'> <'\t\tbad=t\n'> <'\tdone &&\n'> <'\ttest -z "$bad" &&\n'> <'\n'> <'\t# attempt to add another copy of the same\n'> <'\tgit add large3 &&\n'> <'\tbad= count=0 &&\n'> <'\tfor p in .git/objects/pack/pack-*.pack\n'> <'\tdo\n'> <'\t\tcount=$(( $count + 1 ))\n'> <'\t\tif test -f "$p" && idx=${p%.pack}.idx && test -f "$idx"\n'> <'\t\tthen\n'> <'\t\t\tcontinue\n'> <'\t\tfi\n'> <'\t\tbad=t\n'> <'\tdone &&\n'> <'\ttest -z "$bad" &&\n'> <'\ttest $count = 1\n'> ) } ) (C {<test_expect_success>} {(SQ <'checkout a large file'>)} { (SQ <'\n'> <'\tlarge1=$(git rev-parse :large1) &&\n'> <'\tgit update-index --add --cacheinfo 100644 $large1 another &&\n'> <'\tgit checkout another &&\n'> <'\ttest_cmp large1 another\n'> ) } ) (C {<test_expect_success>} {(SQ <'packsize limit'>)} { (SQ <'\n'> <'\ttest_create_repo mid &&\n'> <'\t(\n'> <'\t\tcd mid &&\n'> <'\t\tgit config core.bigfilethreshold 64k &&\n'> <'\t\tgit config pack.packsizelimit 256k &&\n'> <'\n'> <'\t\t# mid1 and mid2 will fit within 256k limit but\n'> <'\t\t# appending mid3 will bust the limit and will\n'> <'\t\t# result in a separate packfile.\n'> <'\t\ttest-genrandom "a" $(( 66 * 1024 )) >mid1 &&\n'> <'\t\ttest-genrandom "b" $(( 80 * 1024 )) >mid2 &&\n'> <'\t\ttest-genrandom "c" $(( 128 * 1024 )) >mid3 &&\n'> <'\t\tgit add mid1 mid2 mid3 &&\n'> <'\n'> <'\t\tcount=0\n'> <'\t\tfor pi in .git/objects/pack/pack-*.idx\n'> <'\t\tdo\n'> <'\t\t\ttest -f "$pi" && count=$(( $count + 1 ))\n'> <'\t\tdone &&\n'> <'\t\ttest $count = 2 &&\n'> <'\n'> <'\t\t(\n'> <'\t\t\tgit hash-object --stdin <mid1\n'> <'\t\t\tgit hash-object --stdin <mid2\n'> <'\t\t\tgit hash-object --stdin <mid3\n'> <'\t\t) |\n'> <'\t\tsort >expect &&\n'> <'\n'> <'\t\tfor pi in .git/objects/pack/pack-*.idx\n'> <'\t\tdo\n'> <'\t\t\tgit show-index <"$pi"\n'> <'\t\tdone |\n'> <'\t\tsed -e "s/^[0-9]* \\([0-9a-f]*\\) .*/\\1/" |\n'> <'\t\tsort >actual &&\n'> <'\n'> <'\t\ttest_cmp expect actual\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'diff --raw'>)} { (SQ <'\n'> <'\tgit commit -q -m initial &&\n'> <'\techo modified >>large1 &&\n'> <'\tgit add large1 &&\n'> <'\tgit commit -q -m modified &&\n'> <'\tgit diff --raw HEAD^\n'> ) } ) (C {<test_expect_success>} {(SQ <'diff --stat'>)} {(SQ <'\n'> <'\tgit diff --stat HEAD^ HEAD\n'>)}) (C {<test_expect_success>} {(SQ <diff>)} {(SQ <'\n'> <'\tgit diff HEAD^ HEAD >actual &&\n'> <'\tgrep "Binary files.*differ" actual\n'>)} ) (C {<test_expect_success>} {(SQ <'diff --cached'>)} { (SQ <'\n'> <'\tgit diff --cached HEAD^ >actual &&\n'> <'\tgrep "Binary files.*differ" actual\n'> ) } ) (C {<test_expect_success>} {(SQ <hash-object>)} {(SQ <'\n'> <'\tgit hash-object large1\n'>)}) (C {<test_expect_success>} {(SQ <'cat-file a large file'>)} {(SQ <'\n'> <'\tgit cat-file blob :large1 >/dev/null\n'>)} ) (C {<test_expect_success>} {(SQ <'cat-file a large file from a tag'>)} { (SQ <'\n'> <'\tgit tag -m largefile largefiletag :large1 &&\n'> <'\tgit cat-file blob largefiletag >/dev/null\n'> ) } ) (C {<test_expect_success>} {(SQ <'git-show a large file'>)} {(SQ <'\n'> <'\tgit show :large1 >/dev/null\n'> <'\n'>)} ) (C {<test_expect_success>} {(SQ <index-pack>)} { (SQ <'\n'> <'\tgit clone file://"$(pwd)"/.git foo &&\n'> <'\tGIT_DIR=non-existent git index-pack --strict --verify foo/.git/objects/pack/*.pack\n'> ) } ) (C {<test_expect_success>} {(SQ <repack>)} {(SQ <'\n'> <'\tgit repack -ad\n'>)}) (C {<test_expect_success>} {(SQ <'pack-objects with large loose object'>)} { (SQ <'\n'> <'\tSHA1=$(git hash-object huge) &&\n'> <'\ttest_create_repo loose &&\n'> <'\techo $SHA1 | git pack-objects --stdout |\n'> <'\t\tGIT_ALLOC_LIMIT=0 GIT_DIR=loose/.git git unpack-objects &&\n'> <'\techo $SHA1 | GIT_DIR=loose/.git git pack-objects pack &&\n'> <'\ttest_create_repo packed &&\n'> <'\tmv pack-* packed/.git/objects/pack &&\n'> <'\tGIT_DIR=packed/.git git cat-file blob $SHA1 >actual &&\n'> <'\ttest_cmp huge actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'tar achiving'>)} {(SQ <'\n'> <'\tgit archive --format=tar HEAD >/dev/null\n'>)} ) (C {<test_expect_success>} {(SQ <'zip achiving, store only'>)} {(SQ <'\n'> <'\tgit archive --format=zip -0 HEAD >/dev/null\n'>)} ) (C {<test_expect_success>} {(SQ <'zip achiving, deflate'>)} {(SQ <'\n'> <'\tgit archive --format=zip HEAD >/dev/null\n'>)} ) (C {<test_expect_success>} {(SQ <'fsck large blobs'>)} {(SQ <'\n'> <'\tgit fsck 2>err &&\n'> <'\ttest_must_be_empty err\n'>)} ) (C {<test_done>}) ] )