fsck tests: setup of bogus commit object
Several fsck tests used the exact same git-hash-object output, but had copy/pasted that part of the setup code. Let's instead do that setup once and use it in subsequent tests. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Sep 3, 2018 at 14:49 UTC
134b7327d05c76d26e501e00d20b5ade9836ac4d
1 file changed
+4
-4
t/t5504-fetch-receive-strict.sh
+4
-4
@@ -133,6 +133,10 @@ committer Bugs Bunny <bugs@bun.ni> 1234567890 +0000
133
This commit object intentionally broken
134
EOF
135
136
+test_expect_success 'setup bogus commit' '
137
+ commit="$(git hash-object -t commit -w --stdin <bogus-commit)"
138
+'
139
+
140
test_expect_success 'fsck with invalid or bogus skipList input' '
141
git -c fsck.skipList=/dev/null -c fsck.missingEmail=ignore fsck &&
142
test_must_fail git -c fsck.skipList=does-not-exist -c fsck.missingEmail=ignore fsck 2>err &&
@@ -142,7 +146,6 @@ test_expect_success 'fsck with invalid or bogus skipList input' '
146
'
147
148
test_expect_success 'push with receive.fsck.skipList' '
145
- commit="$(git hash-object -t commit -w --stdin <bogus-commit)" &&
149
git push . $commit:refs/heads/bogus &&
150
rm -rf dst &&
151
git init dst &&
@@ -169,7 +172,6 @@ test_expect_success 'push with receive.fsck.skipList' '
172
'
173
174
test_expect_success 'fetch with fetch.fsck.skipList' '
172
- commit="$(git hash-object -t commit -w --stdin <bogus-commit)" &&
175
refspec=refs/heads/bogus:refs/heads/bogus &&
176
git push . $commit:refs/heads/bogus &&
177
rm -rf dst &&
@@ -204,7 +206,6 @@ test_expect_success 'fsck.<unknownmsg-id> dies' '
206
'
207
208
test_expect_success 'push with receive.fsck.missingEmail=warn' '
207
- commit="$(git hash-object -t commit -w --stdin <bogus-commit)" &&
209
git push . $commit:refs/heads/bogus &&
210
rm -rf dst &&
211
git init dst &&
@@ -232,7 +233,6 @@ test_expect_success 'push with receive.fsck.missingEmail=warn' '
233
'
234
235
test_expect_success 'fetch with fetch.fsck.missingEmail=warn' '
235
- commit="$(git hash-object -t commit -w --stdin <bogus-commit)" &&
236
refspec=refs/heads/bogus:refs/heads/bogus &&
237
git push . $commit:refs/heads/bogus &&
238
rm -rf dst &&