userdiff: add a builtin pattern for dts files
[gitweb.git] / t / t5324-split-commit-graph.sh
index 130f2baf44d7a305a2c0e78ff80b9c0d140a7e74..99f4ef4c19dff028facac6da810c973b3a82a4fc 100755 (executable)
@@ -163,7 +163,12 @@ test_expect_success 'create fork and chain across alternate' '
                test_line_count = 1 graph-files &&
                git -c core.commitGraph=true  rev-list HEAD >expect &&
                git -c core.commitGraph=false rev-list HEAD >actual &&
-               test_cmp expect actual
+               test_cmp expect actual &&
+               test_commit 14 &&
+               git commit-graph write --reachable --split --object-dir=.git/objects/ &&
+               test_line_count = 3 $graphdir/commit-graph-chain &&
+               ls $graphdir/graph-*.graph >graph-files &&
+               test_line_count = 1 graph-files
        )
 '
 
@@ -232,6 +237,7 @@ corrupt_file() {
        file=$1
        pos=$2
        data="${3:-\0}"
+       chmod a+w "$file" &&
        printf "$data" | dd of="$file" bs=1 seek="$pos" conv=notrunc
 }
 
@@ -290,12 +296,32 @@ test_expect_success 'verify after commit-graph-chain corruption' '
        )
 '
 
+test_expect_success 'verify across alternates' '
+       git clone --no-hardlinks . verify-alt &&
+       (
+               cd verify-alt &&
+               rm -rf $graphdir &&
+               altdir="$(pwd)/../.git/objects" &&
+               echo "$altdir" >.git/objects/info/alternates &&
+               git commit-graph verify --object-dir="$altdir/" &&
+               test_commit extra &&
+               git commit-graph write --reachable --split &&
+               tip_file=$graphdir/graph-$(tail -n 1 $graphdir/commit-graph-chain).graph &&
+               corrupt_file "$tip_file" 100 "\01" &&
+               test_must_fail git commit-graph verify --shallow 2>test_err &&
+               grep -v "^+" test_err >err &&
+               test_i18ngrep "commit-graph has incorrect fanout value" err
+       )
+'
+
 test_expect_success 'add octopus merge' '
        git reset --hard commits/10 &&
        git merge commits/3 commits/4 &&
        git branch merge/octopus &&
        git commit-graph write --reachable --split &&
-       git commit-graph verify &&
+       git commit-graph verify 2>err &&
+       test_line_count = 3 err &&
+       test_i18ngrep ! warning err &&
        test_line_count = 3 $graphdir/commit-graph-chain
 '