]> git.ipfire.org Git - thirdparty/git.git/commit
t: default to compile-time default hash if not set
authorbrian m. carlson <sandals@crustytoothpaste.net>
Tue, 1 Jul 2025 21:22:32 +0000 (21:22 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 1 Jul 2025 21:58:25 +0000 (14:58 -0700)
commitc470ac4ac41b02994f2f10b4134c40661d7435be
tree34086bb7b37b9f2672fd0b36b0017b0de11e18e4
parentd6e616cee741fc3f67fd3b7c328175b932d0aaa5
t: default to compile-time default hash if not set

Right now, the default compile-time hash is SHA-1.  However, in the
future, this might change and it would be helpful to gracefully handle
this case in our testsuite.

To avoid making these assumptions, let's introduce a variable that
contains the built-in default hash and use it in our setup code as the
fallback value if no hash was explicitly set.  For now, this is always
SHA-1, but in a future commit, we'll allow adjusting this and the
variable will be more useful.

To allow us to make our tests more robust, allow test_oid to take the
--hash=builtin option to specify this hash, whatever it is.

Additionally, add a DEFAULT_HASH_ALGORITHM prerequisite to check for the
compile-time hash.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/test-lib-functions.sh
t/test-lib.sh