#!/bin/sh global test_description := ''git pack-object --include-tag'' source ./test-lib.sh global TRASH := $[pwd] test_expect_success setup ' echo c >d && git update-index --add d && tree=$(git write-tree) && commit=$(git commit-tree $tree sig && echo "type commit" >>sig && echo "tag mytag" >>sig && echo "tagger $(git var GIT_COMMITTER_IDENT)" >>sig && echo >>sig && echo "our test tag" >>sig && tag=$(git mktag obj-list ' test_expect_success 'pack without --include-tag' ' packname=$(git pack-objects \ --window=0 \ test-no-include list.expect && test_must_fail git -C clone.git cat-file -e $tag && git -C clone.git rev-list --objects $commit >list.actual && test_cmp list.expect list.actual ' test_expect_success 'pack with --include-tag' ' packname=$(git pack-objects \ --window=0 \ --include-tag \ test-include list.expect && git -C clone.git rev-list --objects $tag >list.actual && test_cmp list.expect list.actual ' # A tag of a tag, where the "inner" tag is not otherwise # reachable, and a full peel points to a commit reachable from HEAD. test_expect_success 'create hidden inner tag' ' test_commit commit && git tag -m inner inner HEAD && git tag -m outer outer inner && git tag -d inner ' test_expect_success 'pack explicit outer tag' ' packname=$( { echo HEAD && echo outer } | git pack-objects --revs test-hidden-explicit ) ' test_expect_success 'unpack objects' ' rm -rf clone.git && git init clone.git && git -C clone.git unpack-objects )} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:TRASH) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(pwd)})]) left_token: spids: [15 17] ) } spids: [14] ) ] spids: [14] ) (C {(test_expect_success)} {(setup)} { (SQ <"\n"> <"\techo c >d &&\n"> <"\tgit update-index --add d &&\n"> <"\ttree=$(git write-tree) &&\n"> <"\tcommit=$(git commit-tree $tree <"\techo \"object $commit\" >sig &&\n"> <"\techo \"type commit\" >>sig &&\n"> <"\techo \"tag mytag\" >>sig &&\n"> <"\techo \"tagger $(git var GIT_COMMITTER_IDENT)\" >>sig &&\n"> <"\techo >>sig &&\n"> <"\techo \"our test tag\" >>sig &&\n"> <"\ttag=$(git mktag <"\trm d sig &&\n"> <"\tgit update-ref refs/tags/mytag $tag && {\n"> <"\t\techo $tree &&\n"> <"\t\techo $commit &&\n"> <"\t\tgit ls-tree $tree | sed -e \"s/.* \\\\([0-9a-f]*\\\\)\t.*/\\\\1/\"\n"> <"\t} >obj-list\n"> ) } ) (C {(test_expect_success)} {(SQ <"pack without --include-tag">)} { (SQ <"\n"> <"\tpackname=$(git pack-objects \\\n"> <"\t\t--window=0 \\\n"> <"\t\ttest-no-include ) } ) (C {(test_expect_success)} {(SQ <"unpack objects">)} { (SQ <"\n"> <"\trm -rf clone.git &&\n"> <"\tgit init clone.git &&\n"> <"\tgit -C clone.git unpack-objects ) } ) (C {(test_expect_success)} {(SQ <"check unpacked result (have commit, no tag)">)} { (SQ <"\n"> <"\tgit rev-list --objects $commit >list.expect &&\n"> <"\ttest_must_fail git -C clone.git cat-file -e $tag &&\n"> <"\tgit -C clone.git rev-list --objects $commit >list.actual &&\n"> <"\ttest_cmp list.expect list.actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"pack with --include-tag">)} { (SQ <"\n"> <"\tpackname=$(git pack-objects \\\n"> <"\t\t--window=0 \\\n"> <"\t\t--include-tag \\\n"> <"\t\ttest-include ) } ) (C {(test_expect_success)} {(SQ <"unpack objects">)} { (SQ <"\n"> <"\trm -rf clone.git &&\n"> <"\tgit init clone.git &&\n"> <"\tgit -C clone.git unpack-objects ) } ) (C {(test_expect_success)} {(SQ <"check unpacked result (have commit, have tag)">)} { (SQ <"\n"> <"\tgit rev-list --objects mytag >list.expect &&\n"> <"\tgit -C clone.git rev-list --objects $tag >list.actual &&\n"> <"\ttest_cmp list.expect list.actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"create hidden inner tag">)} { (SQ <"\n"> <"\ttest_commit commit &&\n"> <"\tgit tag -m inner inner HEAD &&\n"> <"\tgit tag -m outer outer inner &&\n"> <"\tgit tag -d inner\n"> ) } ) (C {(test_expect_success)} {(SQ <"pack explicit outer tag">)} { (SQ <"\n"> <"\tpackname=$(\n"> <"\t\t{\n"> <"\t\t\techo HEAD &&\n"> <"\t\t\techo outer\n"> <"\t\t} |\n"> <"\t\tgit pack-objects --revs test-hidden-explicit\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"unpack objects">)} { (SQ <"\n"> <"\trm -rf clone.git &&\n"> <"\tgit init clone.git &&\n"> <"\tgit -C clone.git unpack-objects ) } ) (C {(test_expect_success)} {(SQ <"check unpacked result (have all objects)">)} {(SQ <"\n"> <"\tgit -C clone.git rev-list --objects $(git rev-parse outer HEAD)\n">)} ) (C {(test_expect_success)} {(SQ <"pack implied outer tag">)} { (SQ <"\n"> <"\tpackname=$(\n"> <"\t\techo HEAD |\n"> <"\t\tgit pack-objects --revs --include-tag test-hidden-implied\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"unpack objects">)} { (SQ <"\n"> <"\trm -rf clone.git &&\n"> <"\tgit init clone.git &&\n"> <"\tgit -C clone.git unpack-objects ) } ) (C {(test_expect_success)} {(SQ <"check unpacked result (have all objects)">)} {(SQ <"\n"> <"\tgit -C clone.git rev-list --objects $(git rev-parse outer HEAD)\n">)} ) (C {(test_expect_success)} {(SQ <"single-branch clone can transfer tag">)} { (SQ <"\n"> <"\trm -rf clone.git &&\n"> <"\tgit clone --no-local --single-branch -b master . clone.git &&\n"> <"\tgit -C clone.git fsck\n"> ) } ) (C {(test_done)}) ] )