ident: don't consider '.' a crud
[git/gitster.git] / t / t5309-pack-delta-cycles.sh
blob4e910c5b9d2a9ddba8c2d808248189fe993873c3
1 #!/bin/sh
3 test_description='test index-pack handling of delta cycles in packfiles'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
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)' '
15 clear_packs &&
17 pack_header 2 &&
18 pack_obj $A $B &&
19 pack_obj $B
20 } >ab.pack &&
21 pack_trailer ab.pack &&
22 git index-pack --stdin <ab.pack &&
23 git cat-file -t $A &&
24 git cat-file -t $B
27 test_expect_success 'index-pack works with a single delta (B->A)' '
28 clear_packs &&
30 pack_header 2 &&
31 pack_obj $A &&
32 pack_obj $B $A
33 } >ba.pack &&
34 pack_trailer ba.pack &&
35 git index-pack --stdin <ba.pack &&
36 git cat-file -t $A &&
37 git cat-file -t $B
40 test_expect_success 'index-pack detects missing base objects' '
41 clear_packs &&
43 pack_header 1 &&
44 pack_obj $A $B
45 } >missing.pack &&
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' '
51 clear_packs &&
53 pack_header 2 &&
54 pack_obj $A $B &&
55 pack_obj $B $A
56 } >cycle.pack &&
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' '
62 clear_packs &&
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' '
68 clear_packs &&
70 pack_header 3 &&
71 pack_obj $A $B &&
72 pack_obj $B $A &&
73 pack_obj $A
74 } >recoverable.pack &&
75 pack_trailer recoverable.pack &&
76 test_must_fail git index-pack --fix-thin --stdin <recoverable.pack
79 test_done