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(48GIT_DIR=clone.git &&49export GIT_DIR &&50test_must_fail git cat-file -e $tag &&51git rev-list --objects $commit52) >list.actual &&53test_cmp list.expect list.actual54'5556rm -rf clone.git57test_expect_success 'pack with --include-tag' '58packname_1=$(git pack-objects \59--window=0 \60--include-tag \61test-2 <obj-list)62'6364test_expect_success 'unpack objects' '65(66GIT_DIR=clone.git &&67export GIT_DIR &&68git init &&69git unpack-objects -n <test-2-${packname_1}.pack &&70git unpack-objects <test-2-${packname_1}.pack71)72'7374test_expect_success 'check unpacked result (have commit, have tag)' '75git rev-list --objects mytag >list.expect &&76(77GIT_DIR=clone.git &&78export GIT_DIR &&79git rev-list --objects $tag80) >list.actual &&81test_cmp list.expect list.actual82'8384test_done