format-patch: ensure that --rfc and -k are mutually exclusive
[alt-git.git] / t / t5410-receive-pack-alternates.sh
blob7a45d4c311ed345fc0126355642e9e1e4e68d292
1 #!/bin/sh
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
9 . ./test-lib.sh
11 test_expect_success 'setup' '
12 test_commit base &&
13 git clone -s --bare . fork &&
14 git checkout -b public/branch main &&
15 test_commit public &&
16 git checkout -b private/branch main &&
17 test_commit private
20 extract_haves () {
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)" \
28 refs/heads/public/
29 EOF
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
45 test_done