3 # Copyright (c) 2008 Google Inc.
6 test_description
='git-pack-object with missing base
10 TEST_PASSES_SANITIZE_LEAK
=true
17 'test_write_lines a b c d e f g h i >text &&
19 git update-index --add text side &&
20 A=$(echo A | git commit-tree $(git write-tree)) &&
23 git update-index text &&
24 B=$(echo B | git commit-tree $(git write-tree) -p $A) &&
25 git update-ref HEAD $B
28 # Create repository with C whose parent is B.
29 # Repository contains C, C^{tree}, C:text, B, B^{tree}.
30 # Repository is missing B:text (best delta base for C:text).
31 # Repository is missing A (parent of B).
32 # Repository is missing A:side.
36 'base_objects=$(pwd)/.git/objects &&
40 echo "$base_objects" >.git/objects/info/alternates &&
43 git update-index text &&
44 git update-ref HEAD $(echo C | git commit-tree $(git write-tree) -p $B) &&
45 rm .git/objects/info/alternates &&
47 git --git-dir=../.git cat-file commit $B |
48 git hash-object -t commit -w --stdin &&
50 git --git-dir=../.git cat-file tree "$B^{tree}" |
51 git hash-object -t tree -w --stdin
53 C=$(git --git-dir=patch_clone/.git rev-parse HEAD)
56 # Clone patch_clone indirectly by cloning base and fetching.
59 'indirectly clone patch_clone' \
64 test $(git rev-parse HEAD) = $B &&
66 git pull ../patch_clone/.git &&
67 test $(git rev-parse HEAD) = $C
71 # Cloning the patch_clone directly should fail.
74 'clone of patch_clone is incomplete' \
75 '(mkdir user_direct &&
78 test_must_fail git fetch ../patch_clone/.git