3 test_description
='test index-pack handling of delta cycles in packfiles'
5 TEST_PASSES_SANITIZE_LEAK
=true
7 .
"$TEST_DIRECTORY"/lib-pack.sh
9 # Two similar-ish objects that we have computed deltas between.
10 A
=$
(test_oid packlib_7_0
)
11 B
=$
(test_oid packlib_7_76
)
13 # double-check our hand-constucted packs
14 test_expect_success
'index-pack works with a single delta (A->B)' '
21 pack_trailer ab.pack &&
22 git index-pack --stdin <ab.pack &&
27 test_expect_success
'index-pack works with a single delta (B->A)' '
34 pack_trailer ba.pack &&
35 git index-pack --stdin <ba.pack &&
40 test_expect_success
'index-pack detects missing base objects' '
46 pack_trailer missing.pack &&
47 test_must_fail git index-pack --fix-thin --stdin <missing.pack
50 test_expect_success
'index-pack detects REF_DELTA cycles' '
57 pack_trailer cycle.pack &&
58 test_must_fail git index-pack --fix-thin --stdin <cycle.pack
61 test_expect_success
'failover to an object in another pack' '
63 git index-pack --stdin <ab.pack &&
64 test_must_fail git index-pack --stdin --fix-thin <cycle.pack
67 test_expect_success
'failover to a duplicate object in the same pack' '
74 } >recoverable.pack &&
75 pack_trailer recoverable.pack &&
76 test_must_fail git index-pack --fix-thin --stdin <recoverable.pack