Merge branch 'ao/send-email-irt'
[git/kirr.git] / t / t5305-include-tag.sh
blobb061864a8743636ae7759ff4e8ff2694410617a1
1 #!/bin/sh
3 test_description='git pack-object --include-tag'
4 . ./test-lib.sh
6 TRASH=`pwd`
8 test_expect_success setup '
9 echo c >d &&
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 &&
17 echo >>sig &&
18 echo "our test tag" >>sig &&
19 tag=`git mktag <sig` &&
20 rm d sig &&
21 git update-ref refs/tags/mytag $tag && {
22 echo $tree &&
23 echo $commit &&
24 git ls-tree $tree | sed -e "s/.* \\([0-9a-f]*\\) .*/\\1/"
25 } >obj-list
28 rm -rf clone.git
29 test_expect_success 'pack without --include-tag' '
30 packname_1=$(git pack-objects \
31 --window=0 \
32 test-1 <obj-list)
35 test_expect_success 'unpack objects' '
37 GIT_DIR=clone.git &&
38 export GIT_DIR &&
39 git init &&
40 git unpack-objects -n <test-1-${packname_1}.pack &&
41 git unpack-objects <test-1-${packname_1}.pack
45 test_expect_success 'check unpacked result (have commit, no tag)' '
46 git rev-list --objects $commit >list.expect &&
48 GIT_DIR=clone.git &&
49 export GIT_DIR &&
50 test_must_fail git cat-file -e $tag &&
51 git rev-list --objects $commit
52 ) >list.actual &&
53 test_cmp list.expect list.actual
56 rm -rf clone.git
57 test_expect_success 'pack with --include-tag' '
58 packname_1=$(git pack-objects \
59 --window=0 \
60 --include-tag \
61 test-2 <obj-list)
64 test_expect_success 'unpack objects' '
66 GIT_DIR=clone.git &&
67 export GIT_DIR &&
68 git init &&
69 git unpack-objects -n <test-2-${packname_1}.pack &&
70 git unpack-objects <test-2-${packname_1}.pack
74 test_expect_success 'check unpacked result (have commit, have tag)' '
75 git rev-list --objects mytag >list.expect &&
77 GIT_DIR=clone.git &&
78 export GIT_DIR &&
79 git rev-list --objects $tag
80 ) >list.actual &&
81 test_cmp list.expect list.actual
84 test_done