midx: honor the MIDX_PROGRESS flag in midx_repack
[git.git] / t / t5309-pack-delta-cycles.sh
blob491556dad9792619974851ef255198c5d247af2f
1 #!/bin/sh
3 test_description='test index-pack handling of delta cycles in packfiles'
4 . ./test-lib.sh
5 . "$TEST_DIRECTORY"/lib-pack.sh
7 if ! test_have_prereq SHA1
8 then
9 skip_all='not using SHA-1 for objects'
10 test_done
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)' '
19 clear_packs &&
21 pack_header 2 &&
22 pack_obj $A $B &&
23 pack_obj $B
24 } >ab.pack &&
25 pack_trailer ab.pack &&
26 git index-pack --stdin <ab.pack &&
27 git cat-file -t $A &&
28 git cat-file -t $B
31 test_expect_success 'index-pack works with a single delta (B->A)' '
32 clear_packs &&
34 pack_header 2 &&
35 pack_obj $A &&
36 pack_obj $B $A
37 } >ba.pack &&
38 pack_trailer ba.pack &&
39 git index-pack --stdin <ba.pack &&
40 git cat-file -t $A &&
41 git cat-file -t $B
44 test_expect_success 'index-pack detects missing base objects' '
45 clear_packs &&
47 pack_header 1 &&
48 pack_obj $A $B
49 } >missing.pack &&
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' '
55 clear_packs &&
57 pack_header 2 &&
58 pack_obj $A $B &&
59 pack_obj $B $A
60 } >cycle.pack &&
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' '
66 clear_packs &&
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' '
72 clear_packs &&
74 pack_header 3 &&
75 pack_obj $A $B &&
76 pack_obj $B $A &&
77 pack_obj $A
78 } >recoverable.pack &&
79 pack_trailer recoverable.pack &&
80 git index-pack --fix-thin --stdin <recoverable.pack
83 test_done