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