Skip to content

Commit 134b732

Browse files
avargitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1d4361b commit 134b732

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

t/t5504-fetch-receive-strict.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ committer Bugs Bunny <[email protected]> 1234567890 +0000
133133
This commit object intentionally broken
134134
EOF
135135

136+
test_expect_success 'setup bogus commit' '
137+
commit="$(git hash-object -t commit -w --stdin <bogus-commit)"
138+
'
139+
136140
test_expect_success 'fsck with invalid or bogus skipList input' '
137141
git -c fsck.skipList=/dev/null -c fsck.missingEmail=ignore fsck &&
138142
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' '
142146
'
143147

144148
test_expect_success 'push with receive.fsck.skipList' '
145-
commit="$(git hash-object -t commit -w --stdin <bogus-commit)" &&
146149
git push . $commit:refs/heads/bogus &&
147150
rm -rf dst &&
148151
git init dst &&
@@ -169,7 +172,6 @@ test_expect_success 'push with receive.fsck.skipList' '
169172
'
170173

171174
test_expect_success 'fetch with fetch.fsck.skipList' '
172-
commit="$(git hash-object -t commit -w --stdin <bogus-commit)" &&
173175
refspec=refs/heads/bogus:refs/heads/bogus &&
174176
git push . $commit:refs/heads/bogus &&
175177
rm -rf dst &&
@@ -204,7 +206,6 @@ test_expect_success 'fsck.<unknownmsg-id> dies' '
204206
'
205207

206208
test_expect_success 'push with receive.fsck.missingEmail=warn' '
207-
commit="$(git hash-object -t commit -w --stdin <bogus-commit)" &&
208209
git push . $commit:refs/heads/bogus &&
209210
rm -rf dst &&
210211
git init dst &&
@@ -232,7 +233,6 @@ test_expect_success 'push with receive.fsck.missingEmail=warn' '
232233
'
233234

234235
test_expect_success 'fetch with fetch.fsck.missingEmail=warn' '
235-
commit="$(git hash-object -t commit -w --stdin <bogus-commit)" &&
236236
refspec=refs/heads/bogus:refs/heads/bogus &&
237237
git push . $commit:refs/heads/bogus &&
238238
rm -rf dst &&

0 commit comments

Comments
 (0)