3 test_description='git pack-object --include-tag'
8 test_expect_success setup '
10 git update-index --add d &&
11 tree=$(git write-tree) &&
12 commit=$(git commit-tree $tree </dev/null) &&
13 echo "object $commit" >sig &&
14 echo "type commit" >>sig &&
15 echo "tag mytag" >>sig &&
16 echo "tagger $(git var GIT_COMMITTER_IDENT)" >>sig &&
18 echo "our test tag" >>sig &&
19 tag=$(git mktag <sig) &&
21 git update-ref refs/tags/mytag $tag && {
24 git ls-tree $tree | sed -e "s/.* \\([0-9a-f]*\\) .*/\\1/"
28 test_expect_success 'pack without --include-tag' '
29 packname=$(git pack-objects \
31 test-no-include <obj-list)
34 test_expect_success 'unpack objects' '
37 git -C clone.git unpack-objects <test-no-include-${packname}.pack
40 test_expect_success 'check unpacked result (have commit, no tag)' '
41 git rev-list --objects $commit >list.expect &&
42 test_must_fail git -C clone.git cat-file -e $tag &&
43 git -C clone.git rev-list --objects $commit >list.actual &&
44 test_cmp list.expect list.actual
47 test_expect_success 'pack with --include-tag' '
48 packname=$(git pack-objects \
51 test-include <obj-list)
54 test_expect_success 'unpack objects' '
57 git -C clone.git unpack-objects <test-include-${packname}.pack
60 test_expect_success 'check unpacked result (have commit, have tag)' '
61 git rev-list --objects mytag >list.expect &&
62 git -C clone.git rev-list --objects $tag >list.actual &&
63 test_cmp list.expect list.actual
66 # A tag of a tag, where the "inner" tag is not otherwise
67 # reachable, and a full peel points to a commit reachable from HEAD.
68 test_expect_success 'create hidden inner tag' '
70 git tag -m inner inner HEAD &&
71 git tag -m outer outer inner &&
75 test_expect_success 'pack explicit outer tag' '
81 git pack-objects --revs test-hidden-explicit
85 test_expect_success 'unpack objects' '
88 git -C clone.git unpack-objects <test-hidden-explicit-${packname}.pack
91 test_expect_success 'check unpacked result (have all objects)' '
92 git -C clone.git rev-list --objects $(git rev-parse outer HEAD)
95 test_expect_success 'pack implied outer tag' '
98 git pack-objects --revs --include-tag test-hidden-implied
102 test_expect_success 'unpack objects' '
104 git init clone.git &&
105 git -C clone.git unpack-objects <test-hidden-implied-${packname}.pack
108 test_expect_success 'check unpacked result (have all objects)' '
109 git -C clone.git rev-list --objects $(git rev-parse outer HEAD)
112 test_expect_success 'single-branch clone can transfer tag' '
114 git clone --no-local --single-branch -b master . clone.git &&
115 git -C clone.git fsck