Subject: [PATCH 9/9] t: add a prerequisite for a compatibility hash

From: "brian m. carlson" <[email-masked]>
Date: Fri, 19 Sep 2025 01:09:11 +0000

In some cases, we'll need to adjust our test suite to work in a proper
way with a compatibility hash.  For example, in such a case, we'll only
use pack index v3, since v1 and v2 lack support for multiple algorithms.
Since we won't want to write those older formats, we'll need to skip
tests that do so.

Let's add a COMPAT_HASH prerequisite and define the BROKEN_OBJECTS
prerequisite in terms of it.

Signed-off-by: brian m. carlson <[email-masked]>
---
 t/test-lib.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 14c777e4e2..a4bb9ab2d8 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1922,7 +1922,13 @@ test_lazy_prereq DEFAULT_REPO_FORMAT '
 # compatibility, we cannot write such objects because there's no SHA-1
 # compatibility value for a nonexistent object.
 test_lazy_prereq BROKEN_OBJECTS '
-	test -z "$test_repo_compat_hash_algo"
+	! test_have_prereq COMPAT_HASH
+'
+
+# COMPAT_HASH is a test if we're operating in a repository with SHA-256 with
+# SHA-1 compatibility.
+test_lazy_prereq COMPAT_HASH '
+	test -n "$test_repo_compat_hash_algo"
 '
 
 # Ensure that no test accidentally triggers a Git command