1#!/bin/sh23test_description='git pack-object --include-tag'4. ./test-lib.sh56TRASH=`pwd`78test_expect_success setup '9echo c >d &&10git update-index --add d &&11tree=`git write-tree` &&12commit=`git commit-tree $tree </dev/null` &&13echo "object $commit" >sig &&14echo "type commit" >>sig &&15echo "tag mytag" >>sig &&16echo "tagger $(git var GIT_COMMITTER_IDENT)" >>sig &&17echo >>sig &&18echo "our test tag" >>sig &&19tag=`git mktag <sig` &&20rm d sig &&21git update-ref refs/tags/mytag $tag && {22echo $tree &&23echo $commit &&24git ls-tree $tree | sed -e "s/.* \\([0-9a-f]*\\) .*/\\1/"25} >obj-list26'2728rm -rf clone.git29test_expect_success 'pack without --include-tag' '30packname_1=$(git pack-objects \31--window=0 \32test-1 <obj-list)33'3435test_expect_success 'unpack objects' '36(37GIT_DIR=clone.git &&38export GIT_DIR &&39git init &&40git unpack-objects -n <test-1-${packname_1}.pack &&41git unpack-objects <test-1-${packname_1}.pack42)43'4445test_expect_success 'check unpacked result (have commit, no tag)' '46git rev-list --objects $commit >list.expect &&47(48test_must_fail env GIT_DIR=clone.git git cat-file -e $tag &&49git rev-list --objects $commit50) >list.actual &&51test_cmp list.expect list.actual52'5354rm -rf clone.git55test_expect_success 'pack with --include-tag' '56packname_1=$(git pack-objects \57--window=0 \58--include-tag \59test-2 <obj-list)60'6162test_expect_success 'unpack objects' '63(64GIT_DIR=clone.git &&65export GIT_DIR &&66git init &&67git unpack-objects -n <test-2-${packname_1}.pack &&68git unpack-objects <test-2-${packname_1}.pack69)70'7172test_expect_success 'check unpacked result (have commit, have tag)' '73git rev-list --objects mytag >list.expect &&74(75GIT_DIR=clone.git &&76export GIT_DIR &&77git rev-list --objects $tag78) >list.actual &&79test_cmp list.expect list.actual80'8182test_done