@@ -160,68 +160,4 @@ test_expect_success 'new clone fetch main and tags' '
160
160
test_cmp expect actual
161
161
'
162
162
163
- test_expect_success ' atomic fetch with failing backfill' '
164
- git init clone3 &&
165
-
166
- # We want to test whether a failure when backfilling tags correctly
167
- # aborts the complete transaction when `--atomic` is passed: we should
168
- # neither create the branch nor should we create the tag when either
169
- # one of both fails to update correctly.
170
- #
171
- # To trigger failure we simply abort when backfilling a tag.
172
- test_hook -C clone3 reference-transaction <<-\EOF &&
173
- while read oldrev newrev reference
174
- do
175
- if test "$reference" = refs/tags/tag1
176
- then
177
- exit 1
178
- fi
179
- done
180
- EOF
181
-
182
- test_must_fail git -C clone3 fetch --atomic .. $B:refs/heads/something &&
183
- test_must_fail git -C clone3 rev-parse --verify refs/heads/something &&
184
- test_must_fail git -C clone3 rev-parse --verify refs/tags/tag2
185
- '
186
-
187
- test_expect_success ' atomic fetch with backfill should use single transaction' '
188
- git init clone4 &&
189
-
190
- # Fetching with the `--atomic` flag should update all references in a
191
- # single transaction, including backfilled tags. We thus expect to see
192
- # a single reference transaction for the created branch and tags.
193
- cat >expected <<-EOF &&
194
- prepared
195
- $ZERO_OID $B refs/heads/something
196
- $ZERO_OID $S refs/tags/tag2
197
- $ZERO_OID $T refs/tags/tag1
198
- committed
199
- $ZERO_OID $B refs/heads/something
200
- $ZERO_OID $S refs/tags/tag2
201
- $ZERO_OID $T refs/tags/tag1
202
- EOF
203
-
204
- test_hook -C clone4 reference-transaction <<-\EOF &&
205
- ( echo "$*" && cat ) >>actual
206
- EOF
207
-
208
- git -C clone4 fetch --atomic .. $B:refs/heads/something &&
209
- test_cmp expected clone4/actual
210
- '
211
-
212
- test_expect_success ' backfill failure causes command to fail' '
213
- git init clone5 &&
214
-
215
- # Create a tag that is nested below the tag we are about to fetch via
216
- # the backfill mechanism. This causes a D/F conflict when backfilling
217
- # and should thus cause the command to fail.
218
- empty_blob=$(git -C clone5 hash-object -w --stdin </dev/null) &&
219
- git -C clone5 update-ref refs/tags/tag1/nested $empty_blob &&
220
-
221
- test_must_fail git -C clone5 fetch .. $B:refs/heads/something &&
222
- test $B = $(git -C clone5 rev-parse --verify refs/heads/something) &&
223
- test $S = $(git -C clone5 rev-parse --verify tag2) &&
224
- test_must_fail git -C clone5 rev-parse --verify tag1
225
- '
226
-
227
163
test_done
0 commit comments