(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <"git log with invalid commit headers">)}
          spids: [4]
        )
      ]
      spids: [4]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(test_expect_success)} {(SQ <setup>)} 
      {
        (SQ <"\n"> <"\ttest_commit foo &&\n"> <"\n"> <"\tgit cat-file commit HEAD |\n"> 
          <"\tsed \"/^author /s/>/>-<>/\" >broken_email.commit &&\n"> <"\tgit hash-object -w -t commit broken_email.commit >broken_email.hash &&\n"> 
          <"\tgit update-ref refs/heads/broken_email $(cat broken_email.hash)\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"fsck notices broken commit">)} 
      {
        (SQ <"\n"> <"\ttest_must_fail git fsck 2>actual &&\n"> 
          <"\ttest_i18ngrep invalid.author actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"git log with broken author email">)} 
      {
        (SQ <"\n"> <"\t{\n"> <"\t\techo commit $(cat broken_email.hash)\n"> 
          <"\t\techo \"Author: A U Thor <author@example.com>\"\n"> <"\t\techo \"Date:   Thu Apr 7 15:13:13 2005 -0700\"\n"> <"\t\techo\n"> <"\t\techo \"    foo\"\n"> 
          <"\t} >expect.out &&\n"> <"\t: >expect.err &&\n"> <"\n"> <"\tgit log broken_email >actual.out 2>actual.err &&\n"> <"\n"> 
          <"\ttest_cmp expect.out actual.out &&\n"> <"\ttest_cmp expect.err actual.err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"git log --format with broken author email">)} 
      {
        (SQ <"\n"> 
          <"\techo \"A U Thor+author@example.com+Thu Apr 7 15:13:13 2005 -0700\" >expect.out &&\n"> <"\t: >expect.err &&\n"> <"\n"> 
          <"\tgit log --format=\"%an+%ae+%ad\" broken_email >actual.out 2>actual.err &&\n"> <"\n"> <"\ttest_cmp expect.out actual.out &&\n"> <"\ttest_cmp expect.err actual.err\n">
        )
      }
    )
    (FuncDef
      name: munge_author_date
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(git)} {(cat-file)} {(commit)} {(DQ ($ VSub_Number "$1"))}]
                  redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(commit.orig)} spids:[105])]
                )
                (AndOr
                  children: [
                    (SimpleCommand
                      words: [
                        {(sed)}
                        {
                          (DQ ("s/^") (EscapedLiteralPart token:<Lit_EscapedChar "\\(">) ("author .*>") 
                            (EscapedLiteralPart
                              token: <Lit_EscapedChar "\\)">
                            ) (" [0-9]*/") (EscapedLiteralPart token:<Lit_EscapedChar "\\1">) (" ") ($ VSub_Number "$2") (/)
                          )
                        }
                      ]
                      redirects: [
                        (Redir
                          op_id: Redir_Less
                          fd: -1
                          arg_word: {(commit.orig)}
                          spids: [125]
                        )
                        (Redir
                          op_id: Redir_Great
                          fd: -1
                          arg_word: {(commit.munge)}
                          spids: [128]
                        )
                      ]
                    )
                    (C {(git)} {(hash-object)} {(-w)} {(-t)} {(commit)} {(commit.munge)})
                  ]
                  op_id: Op_DAmp
                )
              ]
              op_id: Op_DAmp
            )
          ]
          spids: [92]
        )
      spids: [87 91]
    )
    (C {(test_expect_success)} {(SQ <"unparsable dates produce sentinel value">)} 
      {
        (SQ <"\n"> <"\tcommit=$(munge_author_date HEAD totally_bogus) &&\n"> 
          <"\techo \"Date:   Thu Jan 1 00:00:00 1970 +0000\" >expect &&\n"> <"\tgit log -1 $commit >actual.full &&\n"> <"\tgrep Date <actual.full >actual &&\n"> 
          <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"unparsable dates produce sentinel value (%ad)">)} 
      {
        (SQ <"\n"> <"\tcommit=$(munge_author_date HEAD totally_bogus) &&\n"> <"\techo >expect &&\n"> 
          <"\tgit log -1 --format=%ad $commit >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"date parser recognizes integer overflow">)} 
      {
        (SQ <"\n"> <"\tcommit=$(munge_author_date HEAD 18446744073709551617) &&\n"> 
          <"\techo \"Thu Jan 1 00:00:00 1970 +0000\" >expect &&\n"> <"\tgit log -1 --format=%ad $commit >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"date parser recognizes time_t overflow">)} 
      {
        (SQ <"\n"> <"\tcommit=$(munge_author_date HEAD 18446744073709551614) &&\n"> 
          <"\techo \"Thu Jan 1 00:00:00 1970 +0000\" >expect &&\n"> <"\tgit log -1 --format=%ad $commit >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"absurdly far-in-future date">)} 
      {
        (SQ <"\n"> <"\tcommit=$(munge_author_date HEAD 999999999999999999) &&\n"> 
          <"\tgit log -1 --format=%ad $commit\n">
        )
      }
    )
    (C {(test_done)})
  ]
)