3 test_description
='git receive-pack with alternate ref filtering'
5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
8 TEST_PASSES_SANITIZE_LEAK
=true
11 test_expect_success
'setup' '
13 git clone -s --bare . fork &&
14 git checkout -b public/branch main &&
16 git checkout -b private/branch main &&
21 depacketize | perl
-lne '/^(\S+) \.have/ and print $1'
24 test_expect_success
'with core.alternateRefsCommand' '
25 write_script fork/alternate-refs <<-\EOF &&
26 git --git-dir="$1" for-each-ref \
27 --format="%(objectname)" \
30 test_config -C fork core.alternateRefsCommand ./alternate-refs &&
31 git rev-parse public/branch >expect &&
32 printf "0000" | git receive-pack fork >actual &&
33 extract_haves <actual >actual.haves &&
34 test_cmp expect actual.haves
37 test_expect_success
'with core.alternateRefsPrefixes' '
38 test_config -C fork core.alternateRefsPrefixes "refs/heads/private" &&
39 git rev-parse private/branch >expect &&
40 printf "0000" | git receive-pack fork >actual &&
41 extract_haves <actual >actual.haves &&
42 test_cmp expect actual.haves