]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t5318-commit-graph.sh
commit-graph: verify contents match checksum
[thirdparty/git.git] / t / t5318-commit-graph.sh
index a0cf1f66de64eb8941ce485ec7c654c33c63bb56..fed05e2f12a23511aabf85318036d70cdf903c33 100755 (executable)
@@ -279,6 +279,7 @@ GRAPH_COMMIT_DATA_WIDTH=$(($HASH_LEN + 16))
 GRAPH_OCTOPUS_DATA_OFFSET=$(($GRAPH_COMMIT_DATA_OFFSET + \
                             $GRAPH_COMMIT_DATA_WIDTH * $NUM_COMMITS))
 GRAPH_BYTE_OCTOPUS=$(($GRAPH_OCTOPUS_DATA_OFFSET + 4))
+GRAPH_BYTE_FOOTER=$(($GRAPH_OCTOPUS_DATA_OFFSET + 4 * $NUM_OCTOPUS_EDGES))
 
 # usage: corrupt_graph_and_verify <position> <data> <string>
 # Manipulates the commit-graph file at the position
@@ -393,4 +394,9 @@ test_expect_success 'detect incorrect parent for octopus merge' '
                "invalid parent"
 '
 
+test_expect_success 'detect invalid checksum hash' '
+       corrupt_graph_and_verify $GRAPH_BYTE_FOOTER "\00" \
+               "incorrect checksum"
+'
+
 test_done