(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'test textconv caching'>)}
          spids: [4]
        )
      ]
    )
    (C {<.>} {<./test-lib.sh>})
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir.Redir op:<Id.Redir_Great '>'> fd:-1 arg_word:{<helper>})
        (redir.HereDoc
          op: <Id.Redir_DLess '<<'>
          fd: -1
          here_begin: {(SQ <EOF>)}
          here_end_span_id: 27
          stdin_parts: [
            <'#!/bin/sh\n'>
            <'sed \'s/^/converted: /\' "$@" >helper.out\n'>
            <'cat helper.out\n'>
          ]
        )
      ]
    )
    (C {<chmod>} {<Id.Lit_Other '+'> <x>} {<helper>})
    (C {<test_expect_success>} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'\techo foo content 1 >foo.bin &&\n'> <'\techo bar content 1 >bar.bin &&\n'> 
          <'\tgit add . &&\n'> <'\tgit commit -m one &&\n'> <'\techo foo content 2 >foo.bin &&\n'> 
          <'\techo bar content 2 >bar.bin &&\n'> <'\tgit commit -a -m two &&\n'> <'\techo "*.bin diff=magic" >.gitattributes &&\n'> 
          <'\tgit config diff.magic.textconv ./helper &&\n'> <'\tgit config diff.magic.cachetextconv true\n'>
        )
      }
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir.Redir op:<Id.Redir_Great '>'> fd:-1 arg_word:{<expect>})
        (redir.HereDoc
          op: <Id.Redir_DLess '<<'>
          fd: -1
          here_begin: {<EOF>}
          here_end_span_id: 80
          stdin_parts: [
            <'diff --git a/bar.bin b/bar.bin\n'>
            <'index fcf9166..28283d5 100644\n'>
            <'--- a/bar.bin\n'>
            <'+++ b/bar.bin\n'>
            <'@@ -1 +1 @@\n'>
            <'-converted: bar content 1\n'>
            <'+converted: bar content 2\n'>
            <'diff --git a/foo.bin b/foo.bin\n'>
            <'index d5b9fe3..1345db2 100644\n'>
            <'--- a/foo.bin\n'>
            <'+++ b/foo.bin\n'>
            <'@@ -1 +1 @@\n'>
            <'-converted: foo content 1\n'>
            <'+converted: foo content 2\n'>
          ]
        )
      ]
    )
    (C {<test_expect_success>} {(SQ <'first textconv works'>)} 
      {(SQ <'\n'> <'\tgit diff HEAD^ HEAD >actual &&\n'> <'\ttest_cmp expect actual\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'cached textconv produces same output'>)} 
      {(SQ <'\n'> <'\tgit diff HEAD^ HEAD >actual &&\n'> <'\ttest_cmp expect actual\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'cached textconv does not run helper'>)} 
      {
        (SQ <'\n'> <'\trm -f helper.out &&\n'> <'\tgit diff HEAD^ HEAD >actual &&\n'> 
          <'\ttest_cmp expect actual &&\n'> <'\t! test -r helper.out\n'>
        )
      }
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir.Redir op:<Id.Redir_Great '>'> fd:-1 arg_word:{<expect>})
        (redir.HereDoc
          op: <Id.Redir_DLess '<<'>
          fd: -1
          here_begin: {<EOF>}
          here_end_span_id: 148
          stdin_parts: [
            <'diff --git a/bar.bin b/bar.bin\n'>
            <'index fcf9166..28283d5 100644\n'>
            <'--- a/bar.bin\n'>
            <'+++ b/bar.bin\n'>
            <'@@ -1,2 +1,2 @@\n'>
            <' converted: other\n'>
            <'-converted: bar content 1\n'>
            <'+converted: bar content 2\n'>
            <'diff --git a/foo.bin b/foo.bin\n'>
            <'index d5b9fe3..1345db2 100644\n'>
            <'--- a/foo.bin\n'>
            <'+++ b/foo.bin\n'>
            <'@@ -1,2 +1,2 @@\n'>
            <' converted: other\n'>
            <'-converted: foo content 1\n'>
            <'+converted: foo content 2\n'>
          ]
        )
      ]
    )
    (C {<test_expect_success>} {(SQ <'changing textconv invalidates cache'>)} 
      {
        (SQ <'\n'> <'\techo other >other &&\n'> 
          <'\tgit config diff.magic.textconv "./helper other" &&\n'> <'\tgit diff HEAD^ HEAD >actual &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir.Redir op:<Id.Redir_Great '>'> fd:-1 arg_word:{<expect>})
        (redir.HereDoc
          op: <Id.Redir_DLess '<<'>
          fd: -1
          here_begin: {<EOF>}
          here_end_span_id: 188
          stdin_parts: [
            <'diff --git a/bar.bin b/bar.bin\n'>
            <'index fcf9166..28283d5 100644\n'>
            <'--- a/bar.bin\n'>
            <'+++ b/bar.bin\n'>
            <'@@ -1,2 +1,2 @@\n'>
            <' converted: other\n'>
            <'-converted: bar content 1\n'>
            <'+converted: bar content 2\n'>
            <'diff --git a/foo.bin b/foo.bin\n'>
            <'index d5b9fe3..1345db2 100644\n'>
            <'--- a/foo.bin\n'>
            <'+++ b/foo.bin\n'>
            <'@@ -1 +1 @@\n'>
            <'-converted: foo content 1\n'>
            <'+converted: foo content 2\n'>
          ]
        )
      ]
    )
    (C {<test_expect_success>} {(SQ <'switching diff driver produces correct results'>)} 
      {
        (SQ <'\n'> <'\tgit config diff.moremagic.textconv ./helper &&\n'> 
          <'\techo foo.bin diff=moremagic >>.gitattributes &&\n'> <'\tgit diff HEAD^ HEAD >actual &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'log notes cache and still use cache for -p'>)} 
      {(SQ <'\n'> <'\tgit log --no-walk -p refs/notes/textconv/magic HEAD\n'>)}
    )
    (C {<test_done>})
  ]
)