(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <'tests for the peel_ref optimization of packed-refs'>)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ <'create annotated tag in refs/tags'>)} {(SQ <'\n'> <'\ttest_commit base &&\n'> <'\tgit tag -m annotated foo\n'>)} ) (C {(test_expect_success)} {(SQ <'create annotated tag outside of refs/tags'>)} {(SQ <'\n'> <'\tgit update-ref refs/outside/foo refs/tags/foo\n'>)} ) (FuncDef name: print_ref body: (BraceGroup children: [ (C {(echo)} { (DQ (CommandSubPart command_list: (CommandList children: [(C {(git)} {(rev-parse)} {(DQ ($ VSub_Number '$1'))})] ) left_token: <Left_CommandSub '$('> spids: [52 60] ) (' ') ($ VSub_Number '$1') ) } ) ] spids: [46] ) spids: [42 45] ) (C {(test_expect_success)} {(SQ <'set up expected show-ref output'>)} { (SQ <'\n'> <'\t{\n'> <'\t\tprint_ref "refs/heads/master" &&\n'> <'\t\tprint_ref "refs/outside/foo" &&\n'> <'\t\tprint_ref "refs/outside/foo^{}" &&\n'> <'\t\tprint_ref "refs/tags/base" &&\n'> <'\t\tprint_ref "refs/tags/foo" &&\n'> <'\t\tprint_ref "refs/tags/foo^{}"\n'> <'\t} >expect\n'> ) } ) (C {(test_expect_success)} {(SQ <'refs are peeled outside of refs/tags (loose)'>)} {(SQ <'\n'> <'\tgit show-ref -d >actual &&\n'> <'\ttest_cmp expect actual\n'>)} ) (C {(test_expect_success)} {(SQ <'refs are peeled outside of refs/tags (packed)'>)} { (SQ <'\n'> <'\tgit pack-refs --all &&\n'> <'\tgit show-ref -d >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'create old-style pack-refs without fully-peeled'>)} { (SQ <'\n'> <'\t# Git no longer writes without fully-peeled, so we just write our own\n'> <'\t# from scratch; we could also munge the existing file to remove the\n'> <'\t# fully-peeled bits, but that seems even more prone to failure,\n'> <'\t# especially if the format ever changes again. At least this way we\n'> <'\t# know we are emulating exactly what an older git would have written.\n'> <'\t{\n'> <'\t\techo "# pack-refs with: peeled " &&\n'> <'\t\tprint_ref "refs/heads/master" &&\n'> <'\t\tprint_ref "refs/outside/foo" &&\n'> <'\t\tprint_ref "refs/tags/base" &&\n'> <'\t\tprint_ref "refs/tags/foo" &&\n'> <'\t\techo "^$(git rev-parse "refs/tags/foo^{}")"\n'> <'\t} >tmp &&\n'> <'\tmv tmp .git/packed-refs\n'> ) } ) (C {(test_expect_success)} {(SQ <'refs are peeled outside of refs/tags (old packed)'>)} {(SQ <'\n'> <'\tgit show-ref -d >actual &&\n'> <'\ttest_cmp expect actual\n'>)} ) (C {(test_expect_success)} {(SQ <'peeled refs survive deletion of packed ref'>)} { (SQ <'\n'> <'\tgit pack-refs --all &&\n'> <'\tcp .git/packed-refs fully-peeled &&\n'> <'\tgit branch yadda &&\n'> <'\tgit pack-refs --all &&\n'> <'\tgit branch -d yadda &&\n'> <'\ttest_cmp fully-peeled .git/packed-refs\n'> ) } ) (C {(test_done)}) ] )