@@ -309,26 +309,36 @@ setup_triangle () {
309
309
310
310
printf " line %d\n" $( test_seq 1 100) > big-blob.txt &&
311
311
312
- # Create a server with 2 commits: a commit with a big blob and a child
312
+ # Create a server with 2 commits: a commit with a big tree and a child
313
313
# commit with an incremental change. Also, create a partial clone
314
314
# client that only contains the first commit.
315
315
git init server &&
316
316
git -C server config --local uploadpack.allowfilter 1 &&
317
- cp big-blob.txt server &&
318
- git -C server add big-blob.txt &&
317
+ for i in $( test_seq 1 100)
318
+ do
319
+ echo " make the tree big" > server/file$i &&
320
+ git -C server add file$i
321
+ done &&
319
322
git -C server commit -m " initial" &&
320
323
git clone --bare --filter=tree:0 " file://$( pwd) /server" client &&
321
- echo another line >> server/big-blob.txt &&
322
- git -C server commit -am " append line to big blob " &&
324
+ echo another line >> server/file1 &&
325
+ git -C server commit -am " incremental change " &&
323
326
324
- # Create a promisor remote that only contains the blob from the first
325
- # commit, and set it as the promisor remote of client. Thus, whenever
326
- # the client lazy fetches, the lazy fetch will succeed only if it is
327
- # for this blob.
327
+ # Create a promisor remote that only contains the tree and blob from
328
+ # the first commit.
328
329
git init promisor-remote &&
330
+ git -C server config --local uploadpack.allowanysha1inwant 1 &&
331
+ TREE_HASH=$( git -C server rev-parse HEAD~1^{tree}) &&
332
+ git -C promisor-remote fetch --keep " file://$( pwd) /server" " $TREE_HASH " &&
333
+ git -C promisor-remote count-objects -v > object-count &&
334
+ test_i18ngrep " count: 0" object-count &&
335
+ test_i18ngrep " in-pack: 2" object-count &&
336
+
337
+ # Set it as the promisor remote of client. Thus, whenever
338
+ # the client lazy fetches, the lazy fetch will succeed only if it is
339
+ # for this tree or blob.
329
340
test_commit -C promisor-remote one && # so that ref advertisement is not empty
330
341
git -C promisor-remote config --local uploadpack.allowanysha1inwant 1 &&
331
- git -C promisor-remote hash-object -w --stdin < big-blob.txt &&
332
342
git -C client remote set-url origin " file://$( pwd) /promisor-remote"
333
343
}
334
344
@@ -341,14 +351,14 @@ test_expect_success 'fetch lazy-fetches only to resolve deltas' '
341
351
setup_triangle &&
342
352
343
353
# Exercise to make sure it works. Git will not fetch anything from the
344
- # promisor remote other than for the big blob (because it needs to
354
+ # promisor remote other than for the big tree (because it needs to
345
355
# resolve the delta).
346
356
GIT_TRACE_PACKET="$(pwd)/trace" git -C client \
347
357
fetch "file://$(pwd)/server" master &&
348
358
349
359
# Verify the assumption that the client needed to fetch the delta base
350
360
# to resolve the delta.
351
- git hash-object big-blob.txt >hash &&
361
+ git -C server rev-parse HEAD~1^{tree} >hash &&
352
362
grep "want $(cat hash)" trace
353
363
'
354
364
@@ -370,7 +380,7 @@ test_expect_success 'fetch lazy-fetches only to resolve deltas, protocol v2' '
370
380
371
381
# Verify the assumption that the client needed to fetch the delta base
372
382
# to resolve the delta.
373
- git hash-object big-blob.txt >hash &&
383
+ git -C server rev-parse HEAD~1^{tree} >hash &&
374
384
grep "want $(cat hash)" trace
375
385
'
376
386
0 commit comments