]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t1450-fsck.sh
Merge branch 'maint-2.36' into maint-2.37
[thirdparty/git.git] / t / t1450-fsck.sh
index ab7f31f1dcd5b5b7224ded4099f8316171bdea7d..922984b903417a954f3ae423485b63fe99566749 100755 (executable)
@@ -364,6 +364,20 @@ test_expect_success 'tree entry with type mismatch' '
        test_i18ngrep ! "dangling blob" out
 '
 
+test_expect_success 'tree entry with bogus mode' '
+       test_when_finished "remove_object \$blob" &&
+       test_when_finished "remove_object \$tree" &&
+       blob=$(echo blob | git hash-object -w --stdin) &&
+       blob_oct=$(echo $blob | hex2oct) &&
+       tree=$(printf "100000 foo\0${blob_oct}" |
+              git hash-object -t tree --stdin -w --literally) &&
+       git fsck 2>err &&
+       cat >expect <<-EOF &&
+       warning in tree $tree: badFilemode: contains bad file modes
+       EOF
+       test_cmp expect err
+'
+
 test_expect_success 'tag pointing to nonexistent' '
        badoid=$(test_oid deadbeef) &&
        cat >invalid-tag <<-EOF &&
@@ -937,4 +951,28 @@ test_expect_success 'fsck error and recovery on invalid object type' '
        )
 '
 
+test_expect_success 'fsck error on gitattributes with excessive line lengths' '
+       blob=$(printf "pattern %02048d" 1 | git hash-object -w --stdin) &&
+       test_when_finished "remove_object $blob" &&
+       tree=$(printf "100644 blob %s\t%s\n" $blob .gitattributes | git mktree) &&
+       test_when_finished "remove_object $tree" &&
+       cat >expected <<-EOF &&
+       error in blob $blob: gitattributesLineLength: .gitattributes has too long lines to parse
+       EOF
+       test_must_fail git fsck --no-dangling >actual 2>&1 &&
+       test_cmp expected actual
+'
+
+test_expect_success 'fsck error on gitattributes with excessive size' '
+       blob=$(test-tool genzeros $((100 * 1024 * 1024 + 1)) | git hash-object -w --stdin) &&
+       test_when_finished "remove_object $blob" &&
+       tree=$(printf "100644 blob %s\t%s\n" $blob .gitattributes | git mktree) &&
+       test_when_finished "remove_object $tree" &&
+       cat >expected <<-EOF &&
+       error in blob $blob: gitattributesLarge: .gitattributes too large to parse
+       EOF
+       test_must_fail git fsck --no-dangling >actual 2>&1 &&
+       test_cmp expected actual
+'
+
 test_done