]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t0003-attributes.sh
The fifth batch
[thirdparty/git.git] / t / t0003-attributes.sh
index 774b52c2980ca10e6183cf74ad10427f00c2514b..71f082836af6e551c36735f23e82b8cf11865b3d 100755 (executable)
@@ -398,13 +398,19 @@ test_expect_success 'bad attr source defaults to reading .gitattributes file' '
        )
 '
 
-test_expect_success 'bare repo defaults to reading .gitattributes from HEAD' '
+test_expect_success 'bare repo no longer defaults to reading .gitattributes from HEAD' '
        test_when_finished rm -rf test bare_with_gitattribute &&
        git init test &&
        test_commit -C test gitattributes .gitattributes "f/path test=val" &&
        git clone --bare test bare_with_gitattribute &&
-       echo "f/path: test: val" >expect &&
+
+       echo "f/path: test: unspecified" >expect &&
        git -C bare_with_gitattribute check-attr test -- f/path >actual &&
+       test_cmp expect actual &&
+
+       echo "f/path: test: val" >expect &&
+       git -C bare_with_gitattribute -c attr.tree=HEAD \
+               check-attr test -- f/path >actual &&
        test_cmp expect actual
 '
 
@@ -572,6 +578,16 @@ test_expect_success EXPENSIVE 'large attributes file ignored in index' '
        test_cmp expect err
 '
 
+test_expect_success EXPENSIVE 'large attributes blob ignored' '
+       test_when_finished "git update-index --remove .gitattributes" &&
+       blob=$(dd if=/dev/zero bs=1048576 count=101 2>/dev/null | git hash-object -w --stdin) &&
+       git update-index --add --cacheinfo 100644,$blob,.gitattributes &&
+       tree="$(git write-tree)" &&
+       git check-attr --cached --all --source="$tree" path >/dev/null 2>err &&
+       echo "warning: ignoring overly large gitattributes blob ${SQ}.gitattributes${SQ}" >expect &&
+       test_cmp expect err
+'
+
 test_expect_success 'builtin object mode attributes work (dir and regular paths)' '
        >normal &&
        attr_check_object_mode normal 100644 &&