summaryrefslogtreecommitdiff
path: root/t/test-lib.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-05-30 12:51:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-30 12:51:28 (GMT)
commit9472b13201aea57d7f9212ca2678aba4d6dbdfdb (patch)
treee556c8294e01e367c373a6ac0eb6feeb980d7b65 /t/test-lib.sh
parentd89f1248aaf4bb5d1094bc991a50839411935cf6 (diff)
parenteea253bf39c0a8f9995bea1a4c648829c36b79d7 (diff)
downloadgit-9472b13201aea57d7f9212ca2678aba4d6dbdfdb.zip
git-9472b13201aea57d7f9212ca2678aba4d6dbdfdb.tar.gz
git-9472b13201aea57d7f9212ca2678aba4d6dbdfdb.tar.bz2
Merge branch 'bc/hash-independent-tests'
Many tests hardcode the raw object names, which would change once we migrate away from SHA-1. While some of them must test against exact object names, most of them do not have to use hardcoded constants in the test. The latter kind of tests have been updated to test the moral equivalent of the original without hardcoding the actual object names. * bc/hash-independent-tests: (28 commits) t5300: abstract away SHA-1-specific constants t4208: abstract away SHA-1-specific constants t4045: abstract away SHA-1-specific constants t4042: abstract away SHA-1-specific constants t4205: sort log output in a hash-independent way t/lib-diff-alternative: abstract away SHA-1-specific constants t4030: abstract away SHA-1-specific constants t4029: abstract away SHA-1-specific constants t4029: fix test indentation t4022: abstract away SHA-1-specific constants t4020: abstract away SHA-1-specific constants t4014: abstract away SHA-1-specific constants t4008: abstract away SHA-1-specific constants t4007: abstract away SHA-1-specific constants t3905: abstract away SHA-1-specific constants t3702: abstract away SHA-1-specific constants t3103: abstract away SHA-1-specific constants t2203: abstract away SHA-1-specific constants t: skip pack tests if not using SHA-1 t4044: skip test if not using SHA-1 ...
Diffstat (limited to 't/test-lib.sh')
-rw-r--r--t/test-lib.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index f3771ab..2831570 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -184,6 +184,8 @@ _x40="$_x35$_x05"
# Zero SHA-1
_z40=0000000000000000000000000000000000000000
+OID_REGEX="$_x40"
+ZERO_OID=$_z40
EMPTY_TREE=4b825dc642cb6eb9a060e54bf8d69288fbee4904
EMPTY_BLOB=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
@@ -195,7 +197,7 @@ LF='
# when case-folding filenames
u200c=$(printf '\342\200\214')
-export _x05 _x35 _x40 _z40 LF u200c EMPTY_TREE EMPTY_BLOB
+export _x05 _x35 _x40 _z40 LF u200c EMPTY_TREE EMPTY_BLOB ZERO_OID OID_REGEX
# Each test should start with something like this, after copyright notices:
#
@@ -1207,3 +1209,10 @@ test_lazy_prereq TIME_T_IS_64BIT 'test-tool date time_t-is64bit'
test_lazy_prereq CURL '
curl --version
'
+
+# SHA1 is a test if the hash algorithm in use is SHA-1. This is both for tests
+# which will not work with other hash algorithms and tests that work but don't
+# test anything meaningful (e.g. special values which cause short collisions).
+test_lazy_prereq SHA1 '
+ test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
+'