#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # global test_description := ''git pack-object '' source ./test-lib.sh global TRASH := $[pwd] test_expect_success \ 'setup' \ 'rm -f .git/index* && perl -e "print \"a\" x 4096;" > a && perl -e "print \"b\" x 4096;" > b && perl -e "print \"c\" x 4096;" > c && test-genrandom "seed a" 2097152 > a_big && test-genrandom "seed b" 2097152 > b_big && git update-index --add a a_big b b_big c && cat c >d && echo foo >>d && git update-index --add d && tree=$(git write-tree) && commit=$(git commit-tree $tree obj-list && { git diff-tree --root -p $commit && while read object do t=$(git cat-file -t $object) && git cat-file $t $object || return 1 done expect' test_expect_success \ 'pack without delta' \ 'packname_1=$(git pack-objects --window=0 test-1 current && cmp expect current' test_expect_success \ 'use packed deltified (REF_DELTA) objects' \ 'GIT_OBJECT_DIRECTORY=.git2/objects && export GIT_OBJECT_DIRECTORY && rm -f .git2/objects/pack/test-* && cp test-2-${packname_2}.pack test-2-${packname_2}.idx .git2/objects/pack && { git diff-tree --root -p $commit && while read object do t=$(git cat-file -t $object) && git cat-file $t $object || return 1 done current && cmp expect current' test_expect_success \ 'use packed deltified (OFS_DELTA) objects' \ 'GIT_OBJECT_DIRECTORY=.git2/objects && export GIT_OBJECT_DIRECTORY && rm -f .git2/objects/pack/test-* && cp test-3-${packname_3}.pack test-3-${packname_3}.idx .git2/objects/pack && { git diff-tree --root -p $commit && while read object do t=$(git cat-file -t $object) && git cat-file $t $object || return 1 done current && cmp expect current' unset GIT_OBJECT_DIRECTORY test_expect_success 'survive missing objects/pack directory' ' ( rm -fr missing-pack && mkdir missing-pack && cd missing-pack && git init && GOP=.git/objects/pack rm -fr $GOP && git index-pack --stdin --keep=test <../test-3-${packname_3}.pack && test -f $GOP/pack-${packname_3}.pack && cmp $GOP/pack-${packname_3}.pack ../test-3-${packname_3}.pack && test -f $GOP/pack-${packname_3}.idx && cmp $GOP/pack-${packname_3}.idx ../test-3-${packname_3}.idx && test -f $GOP/pack-${packname_3}.keep ) ' test_expect_success \ 'verify pack' \ 'git verify-pack test-1-${packname_1}.idx \ test-2-${packname_2}.idx \ test-3-${packname_3}.idx' test_expect_success \ 'verify pack -v' \ 'git verify-pack -v test-1-${packname_1}.idx \ test-2-${packname_2}.idx \ test-3-${packname_3}.idx' test_expect_success \ 'verify-pack catches mismatched .idx and .pack files' \ 'cat test-1-${packname_1}.idx >test-3.idx && cat test-2-${packname_2}.pack >test-3.pack && if git verify-pack test-3.idx then false else :; fi' test_expect_success \ 'verify-pack catches a corrupted pack signature' \ 'cat test-1-${packname_1}.pack >test-3.pack && echo | dd of=test-3.pack count=1 bs=1 conv=notrunc seek=2 && if git verify-pack test-3.idx then false else :; fi' test_expect_success \ 'verify-pack catches a corrupted pack version' \ 'cat test-1-${packname_1}.pack >test-3.pack && echo | dd of=test-3.pack count=1 bs=1 conv=notrunc seek=7 && if git verify-pack test-3.idx then false else :; fi' test_expect_success \ 'verify-pack catches a corrupted type/size of the 1st packed object data' \ 'cat test-1-${packname_1}.pack >test-3.pack && echo | dd of=test-3.pack count=1 bs=1 conv=notrunc seek=12 && if git verify-pack test-3.idx then false else :; fi' test_expect_success \ 'verify-pack catches a corrupted sum of the index file itself' \ 'l=$(wc -c test-3.pack && printf "%20s" "" | dd of=test-3.idx count=20 bs=1 conv=notrunc seek=$l && if git verify-pack test-3.pack then false else :; fi' test_expect_success \ 'build pack index for an existing pack' \ 'cat test-1-${packname_1}.pack >test-3.pack && git index-pack -o tmp.idx test-3.pack && cmp tmp.idx test-1-${packname_1}.idx && git index-pack test-3.pack && cmp test-3.idx test-1-${packname_1}.idx && cat test-2-${packname_2}.pack >test-3.pack && git index-pack -o tmp.idx test-2-${packname_2}.pack && cmp tmp.idx test-2-${packname_2}.idx && git index-pack test-3.pack && cmp test-3.idx test-2-${packname_2}.idx && cat test-3-${packname_3}.pack >test-3.pack && git index-pack -o tmp.idx test-3-${packname_3}.pack && cmp tmp.idx test-3-${packname_3}.idx && git index-pack test-3.pack && cmp test-3.idx test-3-${packname_3}.idx && cat test-1-${packname_1}.pack >test-4.pack && rm -f test-4.keep && git index-pack --keep=why test-4.pack && cmp test-1-${packname_1}.idx test-4.idx && test -f test-4.keep && :' test_expect_success 'unpacking with --strict' ' for j in a b c d e f g do for i in 0 1 2 3 4 5 6 7 8 9 do o=$(echo $j$i | git hash-object -w --stdin) && echo "100644 $o 0 $j$i" done done >LIST && rm -f .git/index && git update-index --index-info LIST && rm -f .git/index && git update-index --index-info msg && test_i18ngrep "SHA1 COLLISION FOUND" msg' test_expect_success \ 'make sure index-pack detects the SHA1 collision (large blobs)' \ 'test_must_fail git -c core.bigfilethreshold=1 index-pack -o bad.idx test-3.pack 2>msg && test_i18ngrep "SHA1 COLLISION FOUND" msg' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"git pack-object\n"> <"\n">)} spids: [13] ) ] spids: [13] ) (C {(.)} {(./test-lib.sh)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:TRASH) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(pwd)})]) left_token: spids: [25 27] ) } spids: [24] ) ] spids: [24] ) (C {(test_expect_success)} {(SQ )} { (SQ <"rm -f .git/index* &&\n"> <" perl -e \"print \\\"a\\\" x 4096;\" > a &&\n"> <" perl -e \"print \\\"b\\\" x 4096;\" > b &&\n"> <" perl -e \"print \\\"c\\\" x 4096;\" > c &&\n"> <" test-genrandom \"seed a\" 2097152 > a_big &&\n"> <" test-genrandom \"seed b\" 2097152 > b_big &&\n"> <" git update-index --add a a_big b b_big c &&\n"> <" cat c >d && echo foo >>d && git update-index --add d &&\n"> <" tree=$(git write-tree) &&\n"> <" commit=$(git commit-tree $tree <"\t echo $tree &&\n"> <"\t echo $commit &&\n"> <"\t git ls-tree $tree | sed -e \"s/.* \\\\([0-9a-f]*\\\\)\t.*/\\\\1/\"\n"> <" } >obj-list && {\n"> <"\t git diff-tree --root -p $commit &&\n"> <"\t while read object\n"> <"\t do\n"> <"\t t=$(git cat-file -t $object) &&\n"> <"\t git cat-file $t $object || return 1\n"> <"\t done <" } >expect"> ) } ) (C {(test_expect_success)} {(SQ <"pack without delta">)} {(SQ <"packname_1=$(git pack-objects --window=0 test-1 )} ) (C {(test_expect_success)} {(SQ <"pack-objects with bogus arguments">)} {(SQ <"test_must_fail git pack-objects --window=0 test-1 blah blah )} ) (C {(rm)} {(-fr)} {(.git2)}) (C {(mkdir)} {(.git2)}) (C {(test_expect_success)} {(SQ <"unpack without delta">)} { (DQ ("GIT_OBJECT_DIRECTORY=.git2/objects &&\n") (" export GIT_OBJECT_DIRECTORY &&\n") (" git init &&\n") (" git unpack-objects -n )} { (SQ <"(cd ../.git && find objects -type f -print) |\n"> <" while read path\n"> <" do\n"> <" cmp $path ../.git/$path || {\n"> <"\t echo $path differs.\n"> <"\t return 1\n"> <"\t }\n"> <" done"> ) } ) (C {(cd)} {(DQ ($ VSub_Name "$TRASH"))}) (C {(test_expect_success)} {(SQ <"pack with REF_DELTA">)} {(SQ <"pwd &&\n"> <" packname_2=$(git pack-objects test-2 )} ) (C {(rm)} {(-fr)} {(.git2)}) (C {(mkdir)} {(.git2)}) (C {(test_expect_success)} {(SQ <"unpack with REF_DELTA">)} { (SQ <"GIT_OBJECT_DIRECTORY=.git2/objects &&\n"> <" export GIT_OBJECT_DIRECTORY &&\n"> <" git init &&\n"> <" git unpack-objects -n <" git unpack-objects ) } ) (C {(unset)} {(GIT_OBJECT_DIRECTORY)}) (C {(cd)} {(DQ ($ VSub_Name "$TRASH") (/.git2))}) (C {(test_expect_success)} {(SQ <"check unpack with REF_DELTA">)} { (SQ <"(cd ../.git && find objects -type f -print) |\n"> <" while read path\n"> <" do\n"> <" cmp $path ../.git/$path || {\n"> <"\t echo $path differs.\n"> <"\t return 1\n"> <"\t }\n"> <" done"> ) } ) (C {(cd)} {(DQ ($ VSub_Name "$TRASH"))}) (C {(test_expect_success)} {(SQ <"pack with OFS_DELTA">)} { (SQ <"pwd &&\n"> <" packname_3=$(git pack-objects --delta-base-offset test-3 ) } ) (C {(rm)} {(-fr)} {(.git2)}) (C {(mkdir)} {(.git2)}) (C {(test_expect_success)} {(SQ <"unpack with OFS_DELTA">)} { (SQ <"GIT_OBJECT_DIRECTORY=.git2/objects &&\n"> <" export GIT_OBJECT_DIRECTORY &&\n"> <" git init &&\n"> <" git unpack-objects -n <" git unpack-objects ) } ) (C {(unset)} {(GIT_OBJECT_DIRECTORY)}) (C {(cd)} {(DQ ($ VSub_Name "$TRASH") (/.git2))}) (C {(test_expect_success)} {(SQ <"check unpack with OFS_DELTA">)} { (SQ <"(cd ../.git && find objects -type f -print) |\n"> <" while read path\n"> <" do\n"> <" cmp $path ../.git/$path || {\n"> <"\t echo $path differs.\n"> <"\t return 1\n"> <"\t }\n"> <" done"> ) } ) (C {(cd)} {(DQ ($ VSub_Name "$TRASH"))}) (C {(test_expect_success)} {(SQ <"compare delta flavors">)} {(SQ <"\n"> <"\tperl -e ">) (EscapedLiteralPart token:) (SQ <"\n"> <"\t\tdefined($_ = -s $_) or die for @ARGV;\n"> <"\t\texit 1 if $ARGV[0] <= $ARGV[1];\n"> <"\t"> ) (EscapedLiteralPart token:) (SQ <" test-2-$packname_2.pack test-3-$packname_3.pack\n">) } ) (C {(rm)} {(-fr)} {(.git2)}) (C {(mkdir)} {(.git2)}) (C {(test_expect_success)} {(SQ <"use packed objects">)} { (SQ <"GIT_OBJECT_DIRECTORY=.git2/objects &&\n"> <" export GIT_OBJECT_DIRECTORY &&\n"> <" git init &&\n"> <" cp test-1-${packname_1}.pack test-1-${packname_1}.idx .git2/objects/pack && {\n"> <"\t git diff-tree --root -p $commit &&\n"> <"\t while read object\n"> <"\t do\n"> <"\t t=$(git cat-file -t $object) &&\n"> <"\t git cat-file $t $object || return 1\n"> <"\t done <" } >current &&\n"> <" cmp expect current"> ) } ) (C {(test_expect_success)} {(SQ <"use packed deltified (REF_DELTA) objects">)} { (SQ <"GIT_OBJECT_DIRECTORY=.git2/objects &&\n"> <" export GIT_OBJECT_DIRECTORY &&\n"> <" rm -f .git2/objects/pack/test-* &&\n"> <" cp test-2-${packname_2}.pack test-2-${packname_2}.idx .git2/objects/pack && {\n"> <"\t git diff-tree --root -p $commit &&\n"> <"\t while read object\n"> <"\t do\n"> <"\t t=$(git cat-file -t $object) &&\n"> <"\t git cat-file $t $object || return 1\n"> <"\t done <" } >current &&\n"> <" cmp expect current"> ) } ) (C {(test_expect_success)} {(SQ <"use packed deltified (OFS_DELTA) objects">)} { (SQ <"GIT_OBJECT_DIRECTORY=.git2/objects &&\n"> <" export GIT_OBJECT_DIRECTORY &&\n"> <" rm -f .git2/objects/pack/test-* &&\n"> <" cp test-3-${packname_3}.pack test-3-${packname_3}.idx .git2/objects/pack && {\n"> <"\t git diff-tree --root -p $commit &&\n"> <"\t while read object\n"> <"\t do\n"> <"\t t=$(git cat-file -t $object) &&\n"> <"\t git cat-file $t $object || return 1\n"> <"\t done <" } >current &&\n"> <" cmp expect current"> ) } ) (C {(unset)} {(GIT_OBJECT_DIRECTORY)}) (C {(test_expect_success)} {(SQ <"survive missing objects/pack directory">)} { (SQ <"\n"> <"\t(\n"> <"\t\trm -fr missing-pack &&\n"> <"\t\tmkdir missing-pack &&\n"> <"\t\tcd missing-pack &&\n"> <"\t\tgit init &&\n"> <"\t\tGOP=.git/objects/pack\n"> <"\t\trm -fr $GOP &&\n"> <"\t\tgit index-pack --stdin --keep=test <../test-3-${packname_3}.pack &&\n"> <"\t\ttest -f $GOP/pack-${packname_3}.pack &&\n"> <"\t\tcmp $GOP/pack-${packname_3}.pack ../test-3-${packname_3}.pack &&\n"> <"\t\ttest -f $GOP/pack-${packname_3}.idx &&\n"> <"\t\tcmp $GOP/pack-${packname_3}.idx ../test-3-${packname_3}.idx &&\n"> <"\t\ttest -f $GOP/pack-${packname_3}.keep\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"verify pack">)} { (SQ <"git verify-pack\ttest-1-${packname_1}.idx \\\n"> <"\t\t\ttest-2-${packname_2}.idx \\\n"> <"\t\t\ttest-3-${packname_3}.idx"> ) } ) (C {(test_expect_success)} {(SQ <"verify pack -v">)} { (SQ <"git verify-pack -v\ttest-1-${packname_1}.idx \\\n"> <"\t\t\ttest-2-${packname_2}.idx \\\n"> <"\t\t\ttest-3-${packname_3}.idx"> ) } ) (C {(test_expect_success)} {(SQ <"verify-pack catches mismatched .idx and .pack files">)} { (SQ <"cat test-1-${packname_1}.idx >test-3.idx &&\n"> <" cat test-2-${packname_2}.pack >test-3.pack &&\n"> <" if git verify-pack test-3.idx\n"> <" then false\n"> <" else :;\n"> <" fi"> ) } ) (C {(test_expect_success)} {(SQ <"verify-pack catches a corrupted pack signature">)} { (SQ <"cat test-1-${packname_1}.pack >test-3.pack &&\n"> <" echo | dd of=test-3.pack count=1 bs=1 conv=notrunc seek=2 &&\n"> <" if git verify-pack test-3.idx\n"> <" then false\n"> <" else :;\n"> <" fi"> ) } ) (C {(test_expect_success)} {(SQ <"verify-pack catches a corrupted pack version">)} { (SQ <"cat test-1-${packname_1}.pack >test-3.pack &&\n"> <" echo | dd of=test-3.pack count=1 bs=1 conv=notrunc seek=7 &&\n"> <" if git verify-pack test-3.idx\n"> <" then false\n"> <" else :;\n"> <" fi"> ) } ) (C {(test_expect_success)} {(SQ <"verify-pack catches a corrupted type/size of the 1st packed object data">)} { (SQ <"cat test-1-${packname_1}.pack >test-3.pack &&\n"> <" echo | dd of=test-3.pack count=1 bs=1 conv=notrunc seek=12 &&\n"> <" if git verify-pack test-3.idx\n"> <" then false\n"> <" else :;\n"> <" fi"> ) } ) (C {(test_expect_success)} {(SQ <"verify-pack catches a corrupted sum of the index file itself">)} { (SQ <"l=$(wc -c <" l=$(expr $l - 20) &&\n"> <" cat test-1-${packname_1}.pack >test-3.pack &&\n"> <" printf \"%20s\" \"\" | dd of=test-3.idx count=20 bs=1 conv=notrunc seek=$l &&\n"> <" if git verify-pack test-3.pack\n"> <" then false\n"> <" else :;\n"> <" fi"> ) } ) (C {(test_expect_success)} {(SQ <"build pack index for an existing pack">)} { (SQ <"cat test-1-${packname_1}.pack >test-3.pack &&\n"> <" git index-pack -o tmp.idx test-3.pack &&\n"> <" cmp tmp.idx test-1-${packname_1}.idx &&\n"> <"\n"> <" git index-pack test-3.pack &&\n"> <" cmp test-3.idx test-1-${packname_1}.idx &&\n"> <"\n"> <" cat test-2-${packname_2}.pack >test-3.pack &&\n"> <" git index-pack -o tmp.idx test-2-${packname_2}.pack &&\n"> <" cmp tmp.idx test-2-${packname_2}.idx &&\n"> <"\n"> <" git index-pack test-3.pack &&\n"> <" cmp test-3.idx test-2-${packname_2}.idx &&\n"> <"\n"> <" cat test-3-${packname_3}.pack >test-3.pack &&\n"> <" git index-pack -o tmp.idx test-3-${packname_3}.pack &&\n"> <" cmp tmp.idx test-3-${packname_3}.idx &&\n"> <"\n"> <" git index-pack test-3.pack &&\n"> <" cmp test-3.idx test-3-${packname_3}.idx &&\n"> <"\n"> <" cat test-1-${packname_1}.pack >test-4.pack &&\n"> <" rm -f test-4.keep &&\n"> <" git index-pack --keep=why test-4.pack &&\n"> <" cmp test-1-${packname_1}.idx test-4.idx &&\n"> <" test -f test-4.keep &&\n"> <"\n"> <" :"> ) } ) (C {(test_expect_success)} {(SQ <"unpacking with --strict">)} { (SQ <"\n"> <"\n"> <"\tfor j in a b c d e f g\n"> <"\tdo\n"> <"\t\tfor i in 0 1 2 3 4 5 6 7 8 9\n"> <"\t\tdo\n"> <"\t\t\to=$(echo $j$i | git hash-object -w --stdin) &&\n"> <"\t\t\techo \"100644 $o\t0 $j$i\"\n"> <"\t\tdone\n"> <"\tdone >LIST &&\n"> <"\trm -f .git/index &&\n"> <"\tgit update-index --index-info <"\tLIST=$(git write-tree) &&\n"> <"\trm -f .git/index &&\n"> <"\thead -n 10 LIST | git update-index --index-info &&\n"> <"\tLI=$(git write-tree) &&\n"> <"\trm -f .git/index &&\n"> <"\ttail -n 10 LIST | git update-index --index-info &&\n"> <"\tST=$(git write-tree) &&\n"> <"\tPACK5=$( git rev-list --objects \"$LIST\" \"$LI\" \"$ST\" | \\\n"> <"\t\tgit pack-objects test-5 ) &&\n"> <"\tPACK6=$( (\n"> <"\t\t\techo \"$LIST\"\n"> <"\t\t\techo \"$LI\"\n"> <"\t\t\techo \"$ST\"\n"> <"\t\t ) | git pack-objects test-6 ) &&\n"> <"\ttest_create_repo test-5 &&\n"> <"\t(\n"> <"\t\tcd test-5 &&\n"> <"\t\tgit unpack-objects --strict <../test-5-$PACK5.pack &&\n"> <"\t\tgit ls-tree -r $LIST &&\n"> <"\t\tgit ls-tree -r $LI &&\n"> <"\t\tgit ls-tree -r $ST\n"> <"\t) &&\n"> <"\ttest_create_repo test-6 &&\n"> <"\t(\n"> <"\t\t# tree-only into empty repo -- many unreachables\n"> <"\t\tcd test-6 &&\n"> <"\t\ttest_must_fail git unpack-objects --strict <../test-6-$PACK6.pack\n"> <"\t) &&\n"> <"\t(\n"> <"\t\t# already populated -- no unreachables\n"> <"\t\tcd test-5 &&\n"> <"\t\tgit unpack-objects --strict <../test-6-$PACK6.pack\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"index-pack with --strict">)} { (SQ <"\n"> <"\n"> <"\tfor j in a b c d e f g\n"> <"\tdo\n"> <"\t\tfor i in 0 1 2 3 4 5 6 7 8 9\n"> <"\t\tdo\n"> <"\t\t\to=$(echo $j$i | git hash-object -w --stdin) &&\n"> <"\t\t\techo \"100644 $o\t0 $j$i\"\n"> <"\t\tdone\n"> <"\tdone >LIST &&\n"> <"\trm -f .git/index &&\n"> <"\tgit update-index --index-info <"\tLIST=$(git write-tree) &&\n"> <"\trm -f .git/index &&\n"> <"\thead -n 10 LIST | git update-index --index-info &&\n"> <"\tLI=$(git write-tree) &&\n"> <"\trm -f .git/index &&\n"> <"\ttail -n 10 LIST | git update-index --index-info &&\n"> <"\tST=$(git write-tree) &&\n"> <"\tPACK5=$( git rev-list --objects \"$LIST\" \"$LI\" \"$ST\" | \\\n"> <"\t\tgit pack-objects test-5 ) &&\n"> <"\tPACK6=$( (\n"> <"\t\t\techo \"$LIST\"\n"> <"\t\t\techo \"$LI\"\n"> <"\t\t\techo \"$ST\"\n"> <"\t\t ) | git pack-objects test-6 ) &&\n"> <"\ttest_create_repo test-7 &&\n"> <"\t(\n"> <"\t\tcd test-7 &&\n"> <"\t\tgit index-pack --strict --stdin <../test-5-$PACK5.pack &&\n"> <"\t\tgit ls-tree -r $LIST &&\n"> <"\t\tgit ls-tree -r $LI &&\n"> <"\t\tgit ls-tree -r $ST\n"> <"\t) &&\n"> <"\ttest_create_repo test-8 &&\n"> <"\t(\n"> <"\t\t# tree-only into empty repo -- many unreachables\n"> <"\t\tcd test-8 &&\n"> <"\t\ttest_must_fail git index-pack --strict --stdin <../test-6-$PACK6.pack\n"> <"\t) &&\n"> <"\t(\n"> <"\t\t# already populated -- no unreachables\n"> <"\t\tcd test-7 &&\n"> <"\t\tgit index-pack --strict --stdin <../test-6-$PACK6.pack\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"honor pack.packSizeLimit">)} { (SQ <"\n"> <"\tgit config pack.packSizeLimit 3m &&\n"> <"\tpackname_10=$(git pack-objects test-10 <"\ttest 2 = $(ls test-10-*.pack | wc -l)\n"> ) } ) (C {(test_expect_success)} {(SQ <"verify resulting packs">)} {(SQ <"\n"> <"\tgit verify-pack test-10-*.pack\n">)} ) (C {(test_expect_success)} {(SQ <"tolerate packsizelimit smaller than biggest object">)} { (SQ <"\n"> <"\tgit config pack.packSizeLimit 1 &&\n"> <"\tpackname_11=$(git pack-objects test-11 <"\ttest 5 = $(ls test-11-*.pack | wc -l)\n"> ) } ) (C {(test_expect_success)} {(SQ <"verify resulting packs">)} {(SQ <"\n"> <"\tgit verify-pack test-11-*.pack\n">)} ) (C {(test_expect_success)} {(SQ <"fake a SHA1 hash collision">)} { (SQ <"test -f\t.git/objects/c8/2de19312b6c3695c0c18f70709a6c535682a67 &&\n"> <" cp -f\t.git/objects/9d/235ed07cd19811a6ceb342de82f190e49c9f68 \\\n"> <"\t\t.git/objects/c8/2de19312b6c3695c0c18f70709a6c535682a67"> ) } ) (C {(test_expect_success)} {(SQ <"make sure index-pack detects the SHA1 collision">)} { (SQ <"test_must_fail git index-pack -o bad.idx test-3.pack 2>msg &&\n"> <" test_i18ngrep \"SHA1 COLLISION FOUND\" msg"> ) } ) (C {(test_expect_success)} {(SQ <"make sure index-pack detects the SHA1 collision (large blobs)">)} { (SQ < "test_must_fail git -c core.bigfilethreshold=1 index-pack -o bad.idx test-3.pack 2>msg &&\n" > <" test_i18ngrep \"SHA1 COLLISION FOUND\" msg"> ) } ) (C {(test_done)}) ] )