3 test_description='test index-pack handling of delta cycles in packfiles'
5 . "$TEST_DIRECTORY"/lib-pack.sh
7 # Two similar-ish objects that we have computed deltas between.
8 A=$(test_oid packlib_7_0)
9 B=$(test_oid packlib_7_76)
11 # double-check our hand-constucted packs
12 test_expect_success 'index-pack works with a single delta (A->B)' '
19 pack_trailer ab.pack &&
20 git index-pack --stdin <ab.pack &&
25 test_expect_success 'index-pack works with a single delta (B->A)' '
32 pack_trailer ba.pack &&
33 git index-pack --stdin <ba.pack &&
38 test_expect_success 'index-pack detects missing base objects' '
44 pack_trailer missing.pack &&
45 test_must_fail git index-pack --fix-thin --stdin <missing.pack
48 test_expect_success 'index-pack detects REF_DELTA cycles' '
55 pack_trailer cycle.pack &&
56 test_must_fail git index-pack --fix-thin --stdin <cycle.pack
59 test_expect_success 'failover to an object in another pack' '
61 git index-pack --stdin <ab.pack &&
62 test_must_fail git index-pack --stdin --fix-thin <cycle.pack
65 test_expect_success 'failover to a duplicate object in the same pack' '
72 } >recoverable.pack &&
73 pack_trailer recoverable.pack &&
74 test_must_fail git index-pack --fix-thin --stdin <recoverable.pack