]>
Commit | Line | Data |
---|---|---|
89284c1d TB |
1 | #!/bin/sh |
2 | ||
3 | test_description='git receive-pack with alternate ref filtering' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
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 | |
14 | ' | |
15 | ||
16 | extract_haves () { | |
17 | depacketize | perl -lne '/^(\S+) \.have/ and print $1' | |
18 | } | |
19 | ||
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 | |
e6641d2f | 26 | test_config -C fork core.alternateRefsCommand ./alternate-refs && |
89284c1d TB |
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 | |
31 | ' | |
32 | ||
40f327fa TB |
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 | |
39 | ' | |
40 | ||
89284c1d | 41 | test_done |