3 test_description='test index-pack handling of delta cycles in packfiles'
5 . "$TEST_DIRECTORY"/lib-pack.sh
7 if ! test_have_prereq SHA1
9 skip_all='not using SHA-1 for objects'
13 # Two similar-ish objects that we have computed deltas between.
14 A=01d7713666f4de822776c7622c10f1b07de280dc
15 B=e68fe8129b546b101aee9510c5328e7f21ca1d18
17 # double-check our hand-constucted packs
18 test_expect_success 'index-pack works with a single delta (A->B)' '
25 pack_trailer ab.pack &&
26 git index-pack --stdin <ab.pack &&
31 test_expect_success 'index-pack works with a single delta (B->A)' '
38 pack_trailer ba.pack &&
39 git index-pack --stdin <ba.pack &&
44 test_expect_success 'index-pack detects missing base objects' '
50 pack_trailer missing.pack &&
51 test_must_fail git index-pack --fix-thin --stdin <missing.pack
54 test_expect_success 'index-pack detects REF_DELTA cycles' '
61 pack_trailer cycle.pack &&
62 test_must_fail git index-pack --fix-thin --stdin <cycle.pack
65 test_expect_failure 'failover to an object in another pack' '
67 git index-pack --stdin <ab.pack &&
68 git index-pack --stdin --fix-thin <cycle.pack
71 test_expect_failure 'failover to a duplicate object in the same pack' '
78 } >recoverable.pack &&
79 pack_trailer recoverable.pack &&
80 git index-pack --fix-thin --stdin <recoverable.pack