object-store: factor out odb_clear_loose_cache()
[git.git] / t / t5410-receive-pack-alternates.sh
blobf00d0da8606dbc26d6d45c987a763798d2187e31
1 #!/bin/sh
3 test_description='git receive-pack with alternate ref filtering'
5 . ./test-lib.sh
7 test_expect_success 'setup' '
8 test_commit base &&
9 git clone -s --bare . fork &&
10 git checkout -b public/branch master &&
11 test_commit public &&
12 git checkout -b private/branch master &&
13 test_commit private
16 extract_haves () {
17 depacketize | perl -lne '/^(\S+) \.have/ and print $1'
20 test_expect_success 'with core.alternateRefsCommand' '
21 write_script fork/alternate-refs <<-\EOF &&
22 git --git-dir="$1" for-each-ref \
23 --format="%(objectname)" \
24 refs/heads/public/
25 EOF
26 test_config -C fork core.alternateRefsCommand ./alternate-refs &&
27 git rev-parse public/branch >expect &&
28 printf "0000" | git receive-pack fork >actual &&
29 extract_haves <actual >actual.haves &&
30 test_cmp expect actual.haves
33 test_expect_success 'with core.alternateRefsPrefixes' '
34 test_config -C fork core.alternateRefsPrefixes "refs/heads/private" &&
35 git rev-parse private/branch >expect &&
36 printf "0000" | git receive-pack fork >actual &&
37 extract_haves <actual >actual.haves &&
38 test_cmp expect actual.haves
41 test_done