Define a built-in attribute macro "binary".
[gitweb.git] / t / t5300-pack-object.sh
index eacb1e92c20bf0efef069ff5ec0af792f95b1252..083095f7f3a6720836f135835091e6d27d18617a 100755 (executable)
@@ -123,11 +123,12 @@ test_expect_success \
      done'
 cd "$TRASH"
 
-test_expect_success \
-    'compare delta flavors' \
-    'size_2=`stat -c "%s" test-2-${packname_2}.pack` &&
-     size_3=`stat -c "%s" test-3-${packname_3}.pack` &&
-     test $size_2 -gt $size_3'
+test_expect_success 'compare delta flavors' '
+       perl -e '\''
+               defined($_ = -s $_) or die for @ARGV;
+               exit 1 if $ARGV[0] <= $ARGV[1];
+       '\'' test-2-$packname_2.pack test-3-$packname_3.pack
+'
 
 rm -fr .git2
 mkdir .git2
@@ -255,4 +256,14 @@ test_expect_success \
 
      :'
 
+test_expect_success \
+    'fake a SHA1 hash collision' \
+    'test -f   .git/objects/c8/2de19312b6c3695c0c18f70709a6c535682a67 &&
+     cp -f     .git/objects/9d/235ed07cd19811a6ceb342de82f190e49c9f68 \
+               .git/objects/c8/2de19312b6c3695c0c18f70709a6c535682a67'
+
+test_expect_failure \
+    'make sure index-pack detects the SHA1 collision' \
+    'git-index-pack -o bad.idx test-3.pack'
+
 test_done