t1010: use BROKEN_OBJECTS prerequisite

When hash compatibility mode is enabled, we cannot write broken objects because they cannot be mapped into the other hash algorithm. Use the BROKEN_OBJECTS prerequisite to disable these tests and the writing of broken objects in this mode. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Oct 9, 2025 at 21:56 UTC db00605c13a9f5709da712671df5c7594c06cf31
1 file changed +8 -5
t/t1010-mktree.sh
+8 -5
@@ -11,10 +11,13 @@ test_expect_success setup '
11 git add "$d" || return 1
12 done &&
13 echo zero >one &&
14 - git update-index --add --info-only one &&
15 - git write-tree --missing-ok >tree.missing &&
16 - git ls-tree $(cat tree.missing) >top.missing &&
17 - git ls-tree -r $(cat tree.missing) >all.missing &&
14 + if test_have_prereq BROKEN_OBJECTS
15 + then
16 + git update-index --add --info-only one &&
17 + git write-tree --missing-ok >tree.missing &&
18 + git ls-tree $(cat tree.missing) >top.missing &&
19 + git ls-tree -r $(cat tree.missing) >all.missing
20 + fi &&
21 echo one >one &&
22 git add one &&
23 git write-tree >tree &&
@@ -53,7 +56,7 @@ test_expect_success 'ls-tree output in wrong order given to mktree (2)' '
56 test_cmp tree.withsub actual
57 '
58
56 -test_expect_success 'allow missing object with --missing' '
59 +test_expect_success BROKEN_OBJECTS 'allow missing object with --missing' '
60 git mktree --missing <top.missing >actual &&
61 test_cmp tree.missing actual
62 '