Revert "fetch: increase test coverage of fetches"
This reverts commit 2a0cafd464709cfa22fe7249290c644a2a26c520, as it expects a working "a ref deletion must produce a single transaction, not one for loose and another for packed" topic, which we do not have.
Junio C Hamano committed
Apr 13, 2022 at 15:58 UTC
347cc1b11dc1082d217a5221fd074e8fb984cdc3
2 files changed
-93
t/t5503-tagfollow.sh
-64
@@ -160,68 +160,4 @@ test_expect_success 'new clone fetch main and tags' '
160
test_cmp expect actual
161
'
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
-
163
test_done
t/t5510-fetch.sh
-29
@@ -343,35 +343,6 @@ test_expect_success 'fetch --atomic --append appends to FETCH_HEAD' '
343
test_cmp expected atomic/.git/FETCH_HEAD
344
'
345
346
-test_expect_success 'fetch --atomic --prune executes a single reference transaction only' '
347
- test_when_finished "rm -rf \"$D\"/atomic" &&
348
-
349
- cd "$D" &&
350
- git branch scheduled-for-deletion &&
351
- git clone . atomic &&
352
- git branch -D scheduled-for-deletion &&
353
- git branch new-branch &&
354
- head_oid=$(git rev-parse HEAD) &&
355
-
356
- # Fetching with the `--atomic` flag should update all references in a
357
- # single transaction.
358
- cat >expected <<-EOF &&
359
- prepared
360
- $ZERO_OID $ZERO_OID refs/remotes/origin/scheduled-for-deletion
361
- $ZERO_OID $head_oid refs/remotes/origin/new-branch
362
- committed
363
- $ZERO_OID $ZERO_OID refs/remotes/origin/scheduled-for-deletion
364
- $ZERO_OID $head_oid refs/remotes/origin/new-branch
365
- EOF
366
-
367
- test_hook -C atomic reference-transaction <<-\EOF &&
368
- ( echo "$*" && cat ) >>actual
369
- EOF
370
-
371
- git -C atomic fetch --atomic --prune origin &&
372
- test_cmp expected atomic/actual
373
-'
374
-
346
test_expect_success '--refmap="" ignores configured refspec' '
347
cd "$TRASH_DIRECTORY" &&
348
git clone "$D" remote-refs &&