@matheusbsbs / matheus-bagliano / commits / 252a4ee66a
Fork 0

t6501: avoid hard-coded objects

This test contains hard-coded invalid object IDs. Make it hash size independent by generating invalid object IDs using the translation tables. Add a setup target to ensure the output of test_oid_init is checked properly. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Reviewed-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Jul 29, 2020 at 23:13 UTC 252a4ee66aa5d0d872b14095047e605367f4d34c
1 file changed +7 -7
t/t6501-freshen-objects.sh
+7 -7
@@ -128,9 +128,9 @@ for repack in '' true; do
128 done
129
130 test_expect_success 'do not complain about existing broken links (commit)' '
131 - cat >broken-commit <<-\EOF &&
132 - tree 0000000000000000000000000000000000000001
133 - parent 0000000000000000000000000000000000000002
131 + cat >broken-commit <<-EOF &&
132 + tree $(test_oid 001)
133 + parent $(test_oid 002)
134 author whatever <whatever@example.com> 1234 -0000
135 committer whatever <whatever@example.com> 1234 -0000
136
@@ -143,8 +143,8 @@ test_expect_success 'do not complain about existing broken links (commit)' '
143 '
144
145 test_expect_success 'do not complain about existing broken links (tree)' '
146 - cat >broken-tree <<-\EOF &&
147 - 100644 blob 0000000000000000000000000000000000000003 foo
146 + cat >broken-tree <<-EOF &&
147 + 100644 blob $(test_oid 003) foo
148 EOF
149 tree=$(git mktree --missing <broken-tree) &&
150 git gc -q 2>stderr &&
@@ -153,8 +153,8 @@ test_expect_success 'do not complain about existing broken links (tree)' '
153 '
154
155 test_expect_success 'do not complain about existing broken links (tag)' '
156 - cat >broken-tag <<-\EOF &&
157 - object 0000000000000000000000000000000000000004
156 + cat >broken-tag <<-EOF &&
157 + object $(test_oid 004)
158 type commit
159 tag broken
160 tagger whatever <whatever@example.com> 1234 -0000