(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'git archive attribute tests'>)}
          spids: [4]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:SUBSTFORMAT)
          op: assign_op.Equal
          rhs: {(SQ <'%H (%h)%n'>)}
          spids: [15]
        )
      ]
    )
    (command.ShFunction
      name: test_expect_exists
      body: 
        (BraceGroup
          children: [
            (C {<test_expect_success>} {(DQ <' '> ($ Id.VSub_Number '$1') <' exists'>)} 
              {(DQ <'test -e '> ($ Id.VSub_Number '$1'))}
            )
          ]
        )
    )
    (command.ShFunction
      name: test_expect_missing
      body: 
        (BraceGroup
          children: [
            (C {<test_expect_success>} {(DQ <' '> ($ Id.VSub_Number '$1') <' does not exist'>)} 
              {(DQ <'test ! -e '> ($ Id.VSub_Number '$1'))}
            )
          ]
        )
    )
    (C {<test_expect_success>} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'\techo ignored >ignored &&\n'> 
          <'\techo ignored export-ignore >>.git/info/attributes &&\n'> <'\tgit add ignored &&\n'> <'\n'> <'\techo ignored by tree >ignored-by-tree &&\n'> 
          <'\techo ignored-by-tree export-ignore >.gitattributes &&\n'> <'\tgit add ignored-by-tree .gitattributes &&\n'> <'\n'> 
          <'\techo ignored by worktree >ignored-by-worktree &&\n'> <'\techo ignored-by-worktree export-ignore >.gitattributes &&\n'> 
          <'\tgit add ignored-by-worktree &&\n'> <'\n'> <'\tprintf "A\\$Format:%s\\$O" "$SUBSTFORMAT" >nosubstfile &&\n'> 
          <'\tprintf "A\\$Format:%s\\$O" "$SUBSTFORMAT" >substfile1 &&\n'> <'\tprintf "A not substituted O" >substfile2 &&\n'> 
          <'\techo "substfile?" export-subst >>.git/info/attributes &&\n'> <'\tgit add nosubstfile substfile1 substfile2 &&\n'> <'\n'> <'\tgit commit -m. &&\n'> <'\n'> 
          <'\tgit clone --bare . bare &&\n'> <'\tcp .git/info/attributes bare/info/attributes\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'git archive'>)} 
      {
        (SQ <'\n'> <'\tgit archive HEAD >archive.tar &&\n'> 
          <'\t(mkdir archive && cd archive && "$TAR" xf -) <archive.tar\n'>
        )
      }
    )
    (C {<test_expect_missing>} {<'archive/ignored'>})
    (C {<test_expect_missing>} {<'archive/ignored-by-tree'>})
    (C {<test_expect_exists>} {<'archive/ignored-by-worktree'>})
    (C {<test_expect_success>} {(SQ <'git archive with worktree attributes'>)} 
      {
        (SQ <'\n'> <'\tgit archive --worktree-attributes HEAD >worktree.tar &&\n'> 
          <'\t(mkdir worktree && cd worktree && "$TAR" xf -) <worktree.tar\n'>
        )
      }
    )
    (C {<test_expect_missing>} {<'worktree/ignored'>})
    (C {<test_expect_exists>} {<'worktree/ignored-by-tree'>})
    (C {<test_expect_missing>} {<'worktree/ignored-by-worktree'>})
    (C {<test_expect_success>} {(SQ <'git archive --worktree-attributes option'>)} 
      {
        (SQ <'\n'> 
          <'\tgit archive --worktree-attributes --worktree-attributes HEAD >worktree.tar &&\n'> <'\t(mkdir worktree2 && cd worktree2 && "$TAR" xf -) <worktree.tar\n'>
        )
      }
    )
    (C {<test_expect_missing>} {<'worktree2/ignored'>})
    (C {<test_expect_exists>} {<'worktree2/ignored-by-tree'>})
    (C {<test_expect_missing>} {<'worktree2/ignored-by-worktree'>})
    (C {<test_expect_success>} {(SQ <'git archive vs. bare'>)} 
      {
        (SQ <'\n'> <'\t(cd bare && git archive HEAD) >bare-archive.tar &&\n'> 
          <'\ttest_cmp_bin archive.tar bare-archive.tar\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'git archive with worktree attributes, bare'>)} 
      {
        (SQ <'\n'> <'\t(cd bare && git archive --worktree-attributes HEAD) >bare-worktree.tar &&\n'> 
          <'\t(mkdir bare-worktree && cd bare-worktree && "$TAR" xf -) <bare-worktree.tar\n'>
        )
      }
    )
    (C {<test_expect_missing>} {<'bare-worktree/ignored'>})
    (C {<test_expect_exists>} {<'bare-worktree/ignored-by-tree'>})
    (C {<test_expect_exists>} {<'bare-worktree/ignored-by-worktree'>})
    (C {<test_expect_success>} {(SQ <export-subst>)} 
      {
        (SQ <'\n'> <'\tgit log "--pretty=format:A${SUBSTFORMAT}O" HEAD >substfile1.expected &&\n'> 
          <'\ttest_cmp nosubstfile archive/nosubstfile &&\n'> <'\ttest_cmp substfile1.expected archive/substfile1 &&\n'> 
          <'\ttest_cmp substfile2 archive/substfile2\n'>
        )
      }
    )
    (C {<test_done>})
  ]
)