85f09be9f422e343fb0ee1e8541882448e2e22a7
1#!/bin/sh
2
3test_description='tests for the peel_ref optimization of packed-refs'
4. ./test-lib.sh
5
6test_expect_success 'create annotated tag in refs/tags' '
7 test_commit base &&
8 git tag -m annotated foo
9'
10
11test_expect_success 'create annotated tag outside of refs/tags' '
12 git update-ref refs/outside/foo refs/tags/foo
13'
14
15# This matches show-ref's output
16print_ref() {
17 echo "$(git rev-parse "$1") $1"
18}
19
20test_expect_success 'set up expected show-ref output' '
21 {
22 print_ref "refs/heads/master" &&
23 print_ref "refs/outside/foo" &&
24 print_ref "refs/outside/foo^{}" &&
25 print_ref "refs/tags/base" &&
26 print_ref "refs/tags/foo" &&
27 print_ref "refs/tags/foo^{}"
28 } >expect
29'
30
31test_expect_success 'refs are peeled outside of refs/tags (loose)' '
32 git show-ref -d >actual &&
33 test_cmp expect actual
34'
35
36test_expect_success 'refs are peeled outside of refs/tags (packed)' '
37 git pack-refs --all &&
38 git show-ref -d >actual &&
39 test_cmp expect actual
40'
41
42test_done