]> git.ipfire.org Git - thirdparty/git.git/blob - t/t0410-partial-clone.sh
Merge branch 'bc/sha-256-part-2'
[thirdparty/git.git] / t / t0410-partial-clone.sh
1 #!/bin/sh
2
3 test_description='partial clone'
4
5 . ./test-lib.sh
6
7 delete_object () {
8 rm $1/.git/objects/$(echo $2 | sed -e 's|^..|&/|')
9 }
10
11 pack_as_from_promisor () {
12 HASH=$(git -C repo pack-objects .git/objects/pack/pack) &&
13 >repo/.git/objects/pack/pack-$HASH.promisor &&
14 echo $HASH
15 }
16
17 promise_and_delete () {
18 HASH=$(git -C repo rev-parse "$1") &&
19 git -C repo tag -a -m message my_annotated_tag "$HASH" &&
20 git -C repo rev-parse my_annotated_tag | pack_as_from_promisor &&
21 # tag -d prints a message to stdout, so redirect it
22 git -C repo tag -d my_annotated_tag >/dev/null &&
23 delete_object repo "$HASH"
24 }
25
26 test_expect_success 'extensions.partialclone without filter' '
27 test_create_repo server &&
28 git clone --filter="blob:none" "file://$(pwd)/server" client &&
29 git -C client config --unset remote.origin.partialclonefilter &&
30 git -C client fetch origin
31 '
32
33 test_expect_success 'convert shallow clone to partial clone' '
34 rm -fr server client &&
35 test_create_repo server &&
36 test_commit -C server my_commit 1 &&
37 test_commit -C server my_commit2 1 &&
38 git clone --depth=1 "file://$(pwd)/server" client &&
39 git -C client fetch --unshallow --filter="blob:none" &&
40 test_cmp_config -C client true remote.origin.promisor &&
41 test_cmp_config -C client blob:none remote.origin.partialclonefilter &&
42 test_cmp_config -C client 1 core.repositoryformatversion
43 '
44
45 test_expect_success 'convert shallow clone to partial clone must fail with any extension' '
46 rm -fr server client &&
47 test_create_repo server &&
48 test_commit -C server my_commit 1 &&
49 test_commit -C server my_commit2 1 &&
50 git clone --depth=1 "file://$(pwd)/server" client &&
51 test_cmp_config -C client 0 core.repositoryformatversion &&
52 git -C client config extensions.partialclone origin &&
53 test_must_fail git -C client fetch --unshallow --filter="blob:none"
54 '
55
56 test_expect_success 'missing reflog object, but promised by a commit, passes fsck' '
57 rm -rf repo &&
58 test_create_repo repo &&
59 test_commit -C repo my_commit &&
60
61 A=$(git -C repo commit-tree -m a HEAD^{tree}) &&
62 C=$(git -C repo commit-tree -m c -p $A HEAD^{tree}) &&
63
64 # Reference $A only from reflog, and delete it
65 git -C repo branch my_branch "$A" &&
66 git -C repo branch -f my_branch my_commit &&
67 delete_object repo "$A" &&
68
69 # State that we got $C, which refers to $A, from promisor
70 printf "$C\n" | pack_as_from_promisor &&
71
72 # Normally, it fails
73 test_must_fail git -C repo fsck &&
74
75 # But with the extension, it succeeds
76 git -C repo config core.repositoryformatversion 1 &&
77 git -C repo config extensions.partialclone "arbitrary string" &&
78 git -C repo fsck
79 '
80
81 test_expect_success 'missing reflog object, but promised by a tag, passes fsck' '
82 rm -rf repo &&
83 test_create_repo repo &&
84 test_commit -C repo my_commit &&
85
86 A=$(git -C repo commit-tree -m a HEAD^{tree}) &&
87 git -C repo tag -a -m d my_tag_name $A &&
88 T=$(git -C repo rev-parse my_tag_name) &&
89 git -C repo tag -d my_tag_name &&
90
91 # Reference $A only from reflog, and delete it
92 git -C repo branch my_branch "$A" &&
93 git -C repo branch -f my_branch my_commit &&
94 delete_object repo "$A" &&
95
96 # State that we got $T, which refers to $A, from promisor
97 printf "$T\n" | pack_as_from_promisor &&
98
99 git -C repo config core.repositoryformatversion 1 &&
100 git -C repo config extensions.partialclone "arbitrary string" &&
101 git -C repo fsck
102 '
103
104 test_expect_success 'missing reflog object alone fails fsck, even with extension set' '
105 rm -rf repo &&
106 test_create_repo repo &&
107 test_commit -C repo my_commit &&
108
109 A=$(git -C repo commit-tree -m a HEAD^{tree}) &&
110 B=$(git -C repo commit-tree -m b HEAD^{tree}) &&
111
112 # Reference $A only from reflog, and delete it
113 git -C repo branch my_branch "$A" &&
114 git -C repo branch -f my_branch my_commit &&
115 delete_object repo "$A" &&
116
117 git -C repo config core.repositoryformatversion 1 &&
118 git -C repo config extensions.partialclone "arbitrary string" &&
119 test_must_fail git -C repo fsck
120 '
121
122 test_expect_success 'missing ref object, but promised, passes fsck' '
123 rm -rf repo &&
124 test_create_repo repo &&
125 test_commit -C repo my_commit &&
126
127 A=$(git -C repo commit-tree -m a HEAD^{tree}) &&
128
129 # Reference $A only from ref
130 git -C repo branch my_branch "$A" &&
131 promise_and_delete "$A" &&
132
133 git -C repo config core.repositoryformatversion 1 &&
134 git -C repo config extensions.partialclone "arbitrary string" &&
135 git -C repo fsck
136 '
137
138 test_expect_success 'missing object, but promised, passes fsck' '
139 rm -rf repo &&
140 test_create_repo repo &&
141 test_commit -C repo 1 &&
142 test_commit -C repo 2 &&
143 test_commit -C repo 3 &&
144 git -C repo tag -a annotated_tag -m "annotated tag" &&
145
146 C=$(git -C repo rev-parse 1) &&
147 T=$(git -C repo rev-parse 2^{tree}) &&
148 B=$(git hash-object repo/3.t) &&
149 AT=$(git -C repo rev-parse annotated_tag) &&
150
151 promise_and_delete "$C" &&
152 promise_and_delete "$T" &&
153 promise_and_delete "$B" &&
154 promise_and_delete "$AT" &&
155
156 git -C repo config core.repositoryformatversion 1 &&
157 git -C repo config extensions.partialclone "arbitrary string" &&
158 git -C repo fsck
159 '
160
161 test_expect_success 'missing CLI object, but promised, passes fsck' '
162 rm -rf repo &&
163 test_create_repo repo &&
164 test_commit -C repo my_commit &&
165
166 A=$(git -C repo commit-tree -m a HEAD^{tree}) &&
167 promise_and_delete "$A" &&
168
169 git -C repo config core.repositoryformatversion 1 &&
170 git -C repo config extensions.partialclone "arbitrary string" &&
171 git -C repo fsck "$A"
172 '
173
174 test_expect_success 'fetching of missing objects' '
175 rm -rf repo &&
176 test_create_repo server &&
177 test_commit -C server foo &&
178 git -C server repack -a -d --write-bitmap-index &&
179
180 git clone "file://$(pwd)/server" repo &&
181 HASH=$(git -C repo rev-parse foo) &&
182 rm -rf repo/.git/objects/* &&
183
184 git -C repo config core.repositoryformatversion 1 &&
185 git -C repo config extensions.partialclone "origin" &&
186 git -C repo cat-file -p "$HASH" &&
187
188 # Ensure that the .promisor file is written, and check that its
189 # associated packfile contains the object
190 ls repo/.git/objects/pack/pack-*.promisor >promisorlist &&
191 test_line_count = 1 promisorlist &&
192 IDX=$(sed "s/promisor$/idx/" promisorlist) &&
193 git verify-pack --verbose "$IDX" >out &&
194 grep "$HASH" out
195 '
196
197 test_expect_success 'fetching of missing objects works with ref-in-want enabled' '
198 # ref-in-want requires protocol version 2
199 git -C server config protocol.version 2 &&
200 git -C server config uploadpack.allowrefinwant 1 &&
201 git -C repo config protocol.version 2 &&
202
203 rm -rf repo/.git/objects/* &&
204 rm -f trace &&
205 GIT_TRACE_PACKET="$(pwd)/trace" git -C repo cat-file -p "$HASH" &&
206 grep "git< fetch=.*ref-in-want" trace
207 '
208
209 test_expect_success 'fetching of missing objects from another promisor remote' '
210 git clone "file://$(pwd)/server" server2 &&
211 test_commit -C server2 bar &&
212 git -C server2 repack -a -d --write-bitmap-index &&
213 HASH2=$(git -C server2 rev-parse bar) &&
214
215 git -C repo remote add server2 "file://$(pwd)/server2" &&
216 git -C repo config remote.server2.promisor true &&
217 git -C repo cat-file -p "$HASH2" &&
218
219 git -C repo fetch server2 &&
220 rm -rf repo/.git/objects/* &&
221 git -C repo cat-file -p "$HASH2" &&
222
223 # Ensure that the .promisor file is written, and check that its
224 # associated packfile contains the object
225 ls repo/.git/objects/pack/pack-*.promisor >promisorlist &&
226 test_line_count = 1 promisorlist &&
227 IDX=$(sed "s/promisor$/idx/" promisorlist) &&
228 git verify-pack --verbose "$IDX" >out &&
229 grep "$HASH2" out
230 '
231
232 test_expect_success 'fetching of missing objects configures a promisor remote' '
233 git clone "file://$(pwd)/server" server3 &&
234 test_commit -C server3 baz &&
235 git -C server3 repack -a -d --write-bitmap-index &&
236 HASH3=$(git -C server3 rev-parse baz) &&
237 git -C server3 config uploadpack.allowfilter 1 &&
238
239 rm repo/.git/objects/pack/pack-*.promisor &&
240
241 git -C repo remote add server3 "file://$(pwd)/server3" &&
242 git -C repo fetch --filter="blob:none" server3 $HASH3 &&
243
244 test_cmp_config -C repo true remote.server3.promisor &&
245
246 # Ensure that the .promisor file is written, and check that its
247 # associated packfile contains the object
248 ls repo/.git/objects/pack/pack-*.promisor >promisorlist &&
249 test_line_count = 1 promisorlist &&
250 IDX=$(sed "s/promisor$/idx/" promisorlist) &&
251 git verify-pack --verbose "$IDX" >out &&
252 grep "$HASH3" out
253 '
254
255 test_expect_success 'fetching of missing blobs works' '
256 rm -rf server server2 repo &&
257 rm -rf server server3 repo &&
258 test_create_repo server &&
259 test_commit -C server foo &&
260 git -C server repack -a -d --write-bitmap-index &&
261
262 git clone "file://$(pwd)/server" repo &&
263 git hash-object repo/foo.t >blobhash &&
264 rm -rf repo/.git/objects/* &&
265
266 git -C server config uploadpack.allowanysha1inwant 1 &&
267 git -C server config uploadpack.allowfilter 1 &&
268 git -C repo config core.repositoryformatversion 1 &&
269 git -C repo config extensions.partialclone "origin" &&
270
271 git -C repo cat-file -p $(cat blobhash)
272 '
273
274 test_expect_success 'fetching of missing trees does not fetch blobs' '
275 rm -rf server repo &&
276 test_create_repo server &&
277 test_commit -C server foo &&
278 git -C server repack -a -d --write-bitmap-index &&
279
280 git clone "file://$(pwd)/server" repo &&
281 git -C repo rev-parse foo^{tree} >treehash &&
282 git hash-object repo/foo.t >blobhash &&
283 rm -rf repo/.git/objects/* &&
284
285 git -C server config uploadpack.allowanysha1inwant 1 &&
286 git -C server config uploadpack.allowfilter 1 &&
287 git -C repo config core.repositoryformatversion 1 &&
288 git -C repo config extensions.partialclone "origin" &&
289 git -C repo cat-file -p $(cat treehash) &&
290
291 # Ensure that the tree, but not the blob, is fetched
292 git -C repo rev-list --objects --missing=print $(cat treehash) >objects &&
293 grep "^$(cat treehash)" objects &&
294 grep "^[?]$(cat blobhash)" objects
295 '
296
297 test_expect_success 'rev-list stops traversal at missing and promised commit' '
298 rm -rf repo &&
299 test_create_repo repo &&
300 test_commit -C repo foo &&
301 test_commit -C repo bar &&
302
303 FOO=$(git -C repo rev-parse foo) &&
304 promise_and_delete "$FOO" &&
305
306 git -C repo config core.repositoryformatversion 1 &&
307 git -C repo config extensions.partialclone "arbitrary string" &&
308 GIT_TEST_COMMIT_GRAPH=0 git -C repo -c core.commitGraph=false rev-list --exclude-promisor-objects --objects bar >out &&
309 grep $(git -C repo rev-parse bar) out &&
310 ! grep $FOO out
311 '
312
313 test_expect_success 'missing tree objects with --missing=allow-promisor and --exclude-promisor-objects' '
314 rm -rf repo &&
315 test_create_repo repo &&
316 test_commit -C repo foo &&
317 test_commit -C repo bar &&
318 test_commit -C repo baz &&
319
320 promise_and_delete $(git -C repo rev-parse bar^{tree}) &&
321 promise_and_delete $(git -C repo rev-parse foo^{tree}) &&
322
323 git -C repo config core.repositoryformatversion 1 &&
324 git -C repo config extensions.partialclone "arbitrary string" &&
325
326 git -C repo rev-list --missing=allow-promisor --objects HEAD >objs 2>rev_list_err &&
327 test_must_be_empty rev_list_err &&
328 # 3 commits, 3 blobs, and 1 tree
329 test_line_count = 7 objs &&
330
331 # Do the same for --exclude-promisor-objects, but with all trees gone.
332 promise_and_delete $(git -C repo rev-parse baz^{tree}) &&
333 git -C repo rev-list --exclude-promisor-objects --objects HEAD >objs 2>rev_list_err &&
334 test_must_be_empty rev_list_err &&
335 # 3 commits, no blobs or trees
336 test_line_count = 3 objs
337 '
338
339 test_expect_success 'missing non-root tree object and rev-list' '
340 rm -rf repo &&
341 test_create_repo repo &&
342 mkdir repo/dir &&
343 echo foo >repo/dir/foo &&
344 git -C repo add dir/foo &&
345 git -C repo commit -m "commit dir/foo" &&
346
347 promise_and_delete $(git -C repo rev-parse HEAD:dir) &&
348
349 git -C repo config core.repositoryformatversion 1 &&
350 git -C repo config extensions.partialclone "arbitrary string" &&
351
352 git -C repo rev-list --missing=allow-any --objects HEAD >objs 2>rev_list_err &&
353 test_must_be_empty rev_list_err &&
354 # 1 commit and 1 tree
355 test_line_count = 2 objs
356 '
357
358 test_expect_success 'rev-list stops traversal at missing and promised tree' '
359 rm -rf repo &&
360 test_create_repo repo &&
361 test_commit -C repo foo &&
362 mkdir repo/a_dir &&
363 echo something >repo/a_dir/something &&
364 git -C repo add a_dir/something &&
365 git -C repo commit -m bar &&
366
367 # foo^{tree} (tree referenced from commit)
368 TREE=$(git -C repo rev-parse foo^{tree}) &&
369
370 # a tree referenced by HEAD^{tree} (tree referenced from tree)
371 TREE2=$(git -C repo ls-tree HEAD^{tree} | grep " tree " | head -1 | cut -b13-52) &&
372
373 promise_and_delete "$TREE" &&
374 promise_and_delete "$TREE2" &&
375
376 git -C repo config core.repositoryformatversion 1 &&
377 git -C repo config extensions.partialclone "arbitrary string" &&
378 git -C repo rev-list --exclude-promisor-objects --objects HEAD >out &&
379 grep $(git -C repo rev-parse foo) out &&
380 ! grep $TREE out &&
381 grep $(git -C repo rev-parse HEAD) out &&
382 ! grep $TREE2 out
383 '
384
385 test_expect_success 'rev-list stops traversal at missing and promised blob' '
386 rm -rf repo &&
387 test_create_repo repo &&
388 echo something >repo/something &&
389 git -C repo add something &&
390 git -C repo commit -m foo &&
391
392 BLOB=$(git -C repo hash-object -w something) &&
393 promise_and_delete "$BLOB" &&
394
395 git -C repo config core.repositoryformatversion 1 &&
396 git -C repo config extensions.partialclone "arbitrary string" &&
397 git -C repo rev-list --exclude-promisor-objects --objects HEAD >out &&
398 grep $(git -C repo rev-parse HEAD) out &&
399 ! grep $BLOB out
400 '
401
402 test_expect_success 'rev-list stops traversal at promisor commit, tree, and blob' '
403 rm -rf repo &&
404 test_create_repo repo &&
405 test_commit -C repo foo &&
406 test_commit -C repo bar &&
407 test_commit -C repo baz &&
408
409 COMMIT=$(git -C repo rev-parse foo) &&
410 TREE=$(git -C repo rev-parse bar^{tree}) &&
411 BLOB=$(git hash-object repo/baz.t) &&
412 printf "%s\n%s\n%s\n" $COMMIT $TREE $BLOB | pack_as_from_promisor &&
413
414 git -C repo config core.repositoryformatversion 1 &&
415 git -C repo config extensions.partialclone "arbitrary string" &&
416 git -C repo rev-list --exclude-promisor-objects --objects HEAD >out &&
417 ! grep $COMMIT out &&
418 ! grep $TREE out &&
419 ! grep $BLOB out &&
420 grep $(git -C repo rev-parse bar) out # sanity check that some walking was done
421 '
422
423 test_expect_success 'rev-list dies for missing objects on cmd line' '
424 rm -rf repo &&
425 test_create_repo repo &&
426 test_commit -C repo foo &&
427 test_commit -C repo bar &&
428 test_commit -C repo baz &&
429
430 COMMIT=$(git -C repo rev-parse foo) &&
431 TREE=$(git -C repo rev-parse bar^{tree}) &&
432 BLOB=$(git hash-object repo/baz.t) &&
433
434 promise_and_delete $COMMIT &&
435 promise_and_delete $TREE &&
436 promise_and_delete $BLOB &&
437
438 git -C repo config core.repositoryformatversion 1 &&
439 git -C repo config extensions.partialclone "arbitrary string" &&
440
441 for OBJ in "$COMMIT" "$TREE" "$BLOB"; do
442 test_must_fail git -C repo rev-list --objects \
443 --exclude-promisor-objects "$OBJ" &&
444 test_must_fail git -C repo rev-list --objects-edge-aggressive \
445 --exclude-promisor-objects "$OBJ" &&
446
447 # Do not die or crash when --ignore-missing is passed.
448 git -C repo rev-list --ignore-missing --objects \
449 --exclude-promisor-objects "$OBJ" &&
450 git -C repo rev-list --ignore-missing --objects-edge-aggressive \
451 --exclude-promisor-objects "$OBJ"
452 done
453 '
454
455 test_expect_success 'single promisor remote can be re-initialized gracefully' '
456 # ensure one promisor is in the promisors list
457 rm -rf repo &&
458 test_create_repo repo &&
459 test_create_repo other &&
460 git -C repo remote add foo "file://$(pwd)/other" &&
461 git -C repo config remote.foo.promisor true &&
462 git -C repo config extensions.partialclone foo &&
463
464 # reinitialize the promisors list
465 git -C repo fetch --filter=blob:none foo
466 '
467
468 test_expect_success 'gc repacks promisor objects separately from non-promisor objects' '
469 rm -rf repo &&
470 test_create_repo repo &&
471 test_commit -C repo one &&
472 test_commit -C repo two &&
473
474 TREE_ONE=$(git -C repo rev-parse one^{tree}) &&
475 printf "$TREE_ONE\n" | pack_as_from_promisor &&
476 TREE_TWO=$(git -C repo rev-parse two^{tree}) &&
477 printf "$TREE_TWO\n" | pack_as_from_promisor &&
478
479 git -C repo config core.repositoryformatversion 1 &&
480 git -C repo config extensions.partialclone "arbitrary string" &&
481 git -C repo gc &&
482
483 # Ensure that exactly one promisor packfile exists, and that it
484 # contains the trees but not the commits
485 ls repo/.git/objects/pack/pack-*.promisor >promisorlist &&
486 test_line_count = 1 promisorlist &&
487 PROMISOR_PACKFILE=$(sed "s/.promisor/.pack/" <promisorlist) &&
488 git verify-pack $PROMISOR_PACKFILE -v >out &&
489 grep "$TREE_ONE" out &&
490 grep "$TREE_TWO" out &&
491 ! grep "$(git -C repo rev-parse one)" out &&
492 ! grep "$(git -C repo rev-parse two)" out &&
493
494 # Remove the promisor packfile and associated files
495 rm $(sed "s/.promisor//" <promisorlist).* &&
496
497 # Ensure that the single other pack contains the commits, but not the
498 # trees
499 ls repo/.git/objects/pack/pack-*.pack >packlist &&
500 test_line_count = 1 packlist &&
501 git verify-pack repo/.git/objects/pack/pack-*.pack -v >out &&
502 grep "$(git -C repo rev-parse one)" out &&
503 grep "$(git -C repo rev-parse two)" out &&
504 ! grep "$TREE_ONE" out &&
505 ! grep "$TREE_TWO" out
506 '
507
508 test_expect_success 'gc does not repack promisor objects if there are none' '
509 rm -rf repo &&
510 test_create_repo repo &&
511 test_commit -C repo one &&
512
513 git -C repo config core.repositoryformatversion 1 &&
514 git -C repo config extensions.partialclone "arbitrary string" &&
515 git -C repo gc &&
516
517 # Ensure that only one pack exists
518 ls repo/.git/objects/pack/pack-*.pack >packlist &&
519 test_line_count = 1 packlist
520 '
521
522 repack_and_check () {
523 rm -rf repo2 &&
524 cp -r repo repo2 &&
525 git -C repo2 repack $1 -d &&
526 git -C repo2 fsck &&
527
528 git -C repo2 cat-file -e $2 &&
529 git -C repo2 cat-file -e $3
530 }
531
532 test_expect_success 'repack -d does not irreversibly delete promisor objects' '
533 rm -rf repo &&
534 test_create_repo repo &&
535 git -C repo config core.repositoryformatversion 1 &&
536 git -C repo config extensions.partialclone "arbitrary string" &&
537
538 git -C repo commit --allow-empty -m one &&
539 git -C repo commit --allow-empty -m two &&
540 git -C repo commit --allow-empty -m three &&
541 git -C repo commit --allow-empty -m four &&
542 ONE=$(git -C repo rev-parse HEAD^^^) &&
543 TWO=$(git -C repo rev-parse HEAD^^) &&
544 THREE=$(git -C repo rev-parse HEAD^) &&
545
546 printf "$TWO\n" | pack_as_from_promisor &&
547 printf "$THREE\n" | pack_as_from_promisor &&
548 delete_object repo "$ONE" &&
549
550 repack_and_check -a "$TWO" "$THREE" &&
551 repack_and_check -A "$TWO" "$THREE" &&
552 repack_and_check -l "$TWO" "$THREE"
553 '
554
555 test_expect_success 'gc stops traversal when a missing but promised object is reached' '
556 rm -rf repo &&
557 test_create_repo repo &&
558 test_commit -C repo my_commit &&
559
560 TREE_HASH=$(git -C repo rev-parse HEAD^{tree}) &&
561 HASH=$(promise_and_delete $TREE_HASH) &&
562
563 git -C repo config core.repositoryformatversion 1 &&
564 git -C repo config extensions.partialclone "arbitrary string" &&
565 git -C repo gc &&
566
567 # Ensure that the promisor packfile still exists, and remove it
568 test -e repo/.git/objects/pack/pack-$HASH.pack &&
569 rm repo/.git/objects/pack/pack-$HASH.* &&
570
571 # Ensure that the single other pack contains the commit, but not the tree
572 ls repo/.git/objects/pack/pack-*.pack >packlist &&
573 test_line_count = 1 packlist &&
574 git verify-pack repo/.git/objects/pack/pack-*.pack -v >out &&
575 grep "$(git -C repo rev-parse HEAD)" out &&
576 ! grep "$TREE_HASH" out
577 '
578
579 test_expect_success 'do not fetch when checking existence of tree we construct ourselves' '
580 rm -rf repo &&
581 test_create_repo repo &&
582 test_commit -C repo base &&
583 test_commit -C repo side1 &&
584 git -C repo checkout base &&
585 test_commit -C repo side2 &&
586
587 git -C repo config core.repositoryformatversion 1 &&
588 git -C repo config extensions.partialclone "arbitrary string" &&
589
590 git -C repo cherry-pick side1
591 '
592
593 . "$TEST_DIRECTORY"/lib-httpd.sh
594 start_httpd
595
596 test_expect_success 'fetching of missing objects from an HTTP server' '
597 rm -rf repo &&
598 SERVER="$HTTPD_DOCUMENT_ROOT_PATH/server" &&
599 test_create_repo "$SERVER" &&
600 test_commit -C "$SERVER" foo &&
601 git -C "$SERVER" repack -a -d --write-bitmap-index &&
602
603 git clone $HTTPD_URL/smart/server repo &&
604 HASH=$(git -C repo rev-parse foo) &&
605 rm -rf repo/.git/objects/* &&
606
607 git -C repo config core.repositoryformatversion 1 &&
608 git -C repo config extensions.partialclone "origin" &&
609 git -C repo cat-file -p "$HASH" &&
610
611 # Ensure that the .promisor file is written, and check that its
612 # associated packfile contains the object
613 ls repo/.git/objects/pack/pack-*.promisor >promisorlist &&
614 test_line_count = 1 promisorlist &&
615 IDX=$(sed "s/promisor$/idx/" promisorlist) &&
616 git verify-pack --verbose "$IDX" >out &&
617 grep "$HASH" out
618 '
619
620 # DO NOT add non-httpd-specific tests here, because the last part of this
621 # test script is only executed when httpd is available and enabled.
622
623 test_done