use strpbrk(3) to search for characters from a given set
[git/debian.git] / t / t5618-alternate-refs.sh
blob3353216f09e52450a28fd10d68df9478dcfc129b
1 #!/bin/sh
3 test_description='test handling of --alternate-refs traversal'
4 . ./test-lib.sh
6 # Avoid test_commit because we want a specific and known set of refs:
8 # base -- one
9 # \ \
10 # two -- merged
12 # where "one" and "two" are on separate refs, and "merged" is available only in
13 # the dependent child repository.
14 test_expect_success 'set up local refs' '
15 git checkout -b one &&
16 test_tick &&
17 git commit --allow-empty -m base &&
18 test_tick &&
19 git commit --allow-empty -m one &&
20 git checkout -b two HEAD^ &&
21 test_tick &&
22 git commit --allow-empty -m two
25 # We'll enter the child repository after it's set up since that's where
26 # all of the subsequent tests will want to run (and it's easy to forget a
27 # "-C child" and get nonsense results).
28 test_expect_success 'set up shared clone' '
29 git clone -s . child &&
30 cd child &&
31 git merge origin/one
34 test_expect_success 'rev-list --alternate-refs' '
35 git rev-list --remotes=origin >expect &&
36 git rev-list --alternate-refs >actual &&
37 test_cmp expect actual
40 test_expect_success 'rev-list --not --alternate-refs' '
41 git rev-parse HEAD >expect &&
42 git rev-list HEAD --not --alternate-refs >actual &&
43 test_cmp expect actual
46 test_expect_success 'limiting with alternateRefsPrefixes' '
47 test_config core.alternateRefsPrefixes refs/heads/one &&
48 git rev-list origin/one >expect &&
49 git rev-list --alternate-refs >actual &&
50 test_cmp expect actual
53 test_expect_success 'log --source shows .alternate marker' '
54 git log --oneline --source --remotes=origin >expect.orig &&
55 sed "s/origin.* /.alternate /" <expect.orig >expect &&
56 git log --oneline --source --alternate-refs >actual &&
57 test_cmp expect actual
60 test_done