t/test-lib: add an SHA1 prerequisite

There are some basic tests in our codebase that test that we get fixed SHA-1 values. These are valuable because they make sure that our SHA-1 implementation is free of bugs, but obviously these tests will fail with a different hash. There are also tests which intentionally produce objects that have collisions when truncated to a certain length to test our handling of these cases. These tests, too, will fail with a different hash. Add an SHA1 prerequisite to annotate both of these types of tests and disable them when we're using a different hash. In the future, we will create versions of these tests which handle both SHA-1 and NewHash. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed May 13, 2018 at 02:24 UTC d16ab63429ba7278a2ec6cd5a5905875982242eb
1 file changed +7
t/test-lib.sh
+7
@@ -1212,3 +1212,10 @@ test_lazy_prereq TIME_T_IS_64BIT 'test-tool date time_t-is64bit'
1212 test_lazy_prereq CURL '
1213 curl --version
1214 '
1215 +
1216 +# SHA1 is a test if the hash algorithm in use is SHA-1. This is both for tests
1217 +# which will not work with other hash algorithms and tests that work but don't
1218 +# test anything meaningful (e.g. special values which cause short collisions).
1219 +test_lazy_prereq SHA1 '
1220 + test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
1221 +'