3 test_description
='test handling of --alternate-refs traversal'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 # Avoid test_commit because we want a specific and known set of refs:
14 # where "one" and "two" are on separate refs, and "merged" is available only in
15 # the dependent child repository.
16 test_expect_success
'set up local refs' '
17 git checkout -b one &&
19 git commit --allow-empty -m base &&
21 git commit --allow-empty -m one &&
22 git checkout -b two HEAD^ &&
24 git commit --allow-empty -m two
27 # We'll enter the child repository after it's set up since that's where
28 # all of the subsequent tests will want to run (and it's easy to forget a
29 # "-C child" and get nonsense results).
30 test_expect_success
'set up shared clone' '
31 git clone -s . child &&
36 test_expect_success
'rev-list --alternate-refs' '
37 git rev-list --remotes=origin >expect &&
38 git rev-list --alternate-refs >actual &&
39 test_cmp expect actual
42 test_expect_success
'rev-list --not --alternate-refs' '
43 git rev-parse HEAD >expect &&
44 git rev-list HEAD --not --alternate-refs >actual &&
45 test_cmp expect actual
48 test_expect_success
'limiting with alternateRefsPrefixes' '
49 test_config core.alternateRefsPrefixes refs/heads/one &&
50 git rev-list origin/one >expect &&
51 git rev-list --alternate-refs >actual &&
52 test_cmp expect actual
55 test_expect_success
'log --source shows .alternate marker' '
56 git log --oneline --source --remotes=origin >expect.orig &&
57 sed "s/origin.* /.alternate /" <expect.orig >expect &&
58 git log --oneline --source --alternate-refs >actual &&
59 test_cmp expect actual