]>
Commit | Line | Data |
---|---|---|
f7f91086 JK |
1 | #!/bin/sh |
2 | ||
3 | test_description='check bitmap operation with shallow repositories' | |
568cc818 PS |
4 | |
5 | TEST_PASSES_SANITIZE_LEAK=true | |
f7f91086 JK |
6 | . ./test-lib.sh |
7 | ||
8 | # We want to create a situation where the shallow, grafted | |
9 | # view of reachability does not match reality in a way that | |
10 | # might cause us to send insufficient objects. | |
11 | # | |
12 | # We do this with a history that repeats a state, like: | |
13 | # | |
14 | # A -- B -- C | |
15 | # file=1 file=2 file=1 | |
16 | # | |
17 | # and then create a shallow clone to the second commit, B. | |
18 | # In a non-shallow clone, that would mean we already have | |
19 | # the tree for A. But in a shallow one, we've grafted away | |
20 | # A, and fetching A to B requires that the other side send | |
21 | # us the tree for file=1. | |
76f14b77 AC |
22 | test_shallow_bitmaps () { |
23 | writeLookupTable=false | |
24 | ||
25 | for i in "$@" | |
26 | do | |
27 | case $i in | |
28 | "pack.writeBitmapLookupTable") writeLookupTable=true;; | |
29 | esac | |
30 | done | |
31 | ||
32 | test_expect_success 'setup shallow repo' ' | |
33 | rm -rf * .git && | |
34 | git init && | |
35 | git config pack.writeBitmapLookupTable '"$writeLookupTable"' && | |
36 | echo 1 >file && | |
37 | git add file && | |
38 | git commit -m orig && | |
39 | echo 2 >file && | |
40 | git commit -a -m update && | |
41 | git clone --no-local --bare --depth=1 . shallow.git && | |
42 | echo 1 >file && | |
43 | git commit -a -m repeat | |
44 | ' | |
45 | ||
46 | test_expect_success 'turn on bitmaps in the parent' ' | |
47 | git repack -adb | |
48 | ' | |
49 | ||
50 | test_expect_success 'shallow fetch from bitmapped repo' ' | |
51 | (cd shallow.git && git fetch) | |
52 | ' | |
53 | } | |
54 | ||
55 | test_shallow_bitmaps | |
56 | test_shallow_bitmaps "pack.writeBitmapLookupTable" | |
f7f91086 JK |
57 | |
58 | test_done |