(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <"git commit --reset-author">)}
          spids: [13]
        )
      ]
      spids: [13]
    )
    (C {(.)} {(./test-lib.sh)})
    (FuncDef
      name: author_header
      body: 
        (BraceGroup
          children: [
            (Pipeline
              children: [
                (C {(git)} {(cat-file)} {(commit)} {(DQ ($ VSub_Number "$1"))})
                (C {(sed)} {(-n)} {(-e)} {(SQ <"/^$/q">)} {(-e)} {(SQ <"/^author /p">)})
              ]
              negated: False
            )
          ]
          spids: [29]
        )
      spids: [24 28]
    )
    (FuncDef
      name: message_body
      body: 
        (BraceGroup
          children: [
            (Pipeline
              children: [
                (C {(git)} {(cat-file)} {(commit)} {(DQ ($ VSub_Number "$1"))})
                (C {(sed)} {(-e)} {(SQ <"1,/^$/d">)})
              ]
              negated: False
            )
          ]
          spids: [69]
        )
      spids: [64 68]
    )
    (C {(test_expect_success)} {(SQ <"-C option copies authorship and message">)} 
      {
        (SQ <"\n"> <"\techo \"Initial\" >foo &&\n"> <"\tgit add foo &&\n"> <"\ttest_tick &&\n"> 
          <"\tgit commit -m \"Initial Commit\" --author Frigate\\ \\<flying@over.world\\> &&\n"> <"\tgit tag Initial &&\n"> <"\techo \"Test 1\" >>foo &&\n"> <"\ttest_tick &&\n"> 
          <"\tgit commit -a -C Initial &&\n"> <"\tauthor_header Initial >expect &&\n"> <"\tauthor_header HEAD >actual &&\n"> 
          <"\ttest_cmp expect actual &&\n"> <"\n"> <"\tmessage_body Initial >expect &&\n"> <"\tmessage_body HEAD >actual &&\n"> 
          <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"-C option copies only the message with --reset-author">)} 
      {
        (SQ <"\n"> <"\techo \"Test 2\" >>foo &&\n"> <"\ttest_tick &&\n"> 
          <"\tgit commit -a -C Initial --reset-author &&\n"> <"\techo \"author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> $GIT_AUTHOR_DATE\" >expect &&\n"> 
          <"\tauthor_header HEAD >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\n"> <"\tmessage_body Initial >expect &&\n"> 
          <"\tmessage_body HEAD >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"-c option copies authorship and message">)} 
      {
        (SQ <"\n"> <"\techo \"Test 3\" >>foo &&\n"> <"\ttest_tick &&\n"> 
          <"\tEDITOR=: VISUAL=: git commit -a -c Initial &&\n"> <"\tauthor_header Initial >expect &&\n"> <"\tauthor_header HEAD >actual &&\n"> 
          <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"-c option copies only the message with --reset-author">)} 
      {
        (SQ <"\n"> <"\techo \"Test 4\" >>foo &&\n"> <"\ttest_tick &&\n"> 
          <"\tEDITOR=: VISUAL=: git commit -a -c Initial --reset-author &&\n"> <"\techo \"author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> $GIT_AUTHOR_DATE\" >expect &&\n"> 
          <"\tauthor_header HEAD >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\n"> <"\tmessage_body Initial >expect &&\n"> 
          <"\tmessage_body HEAD >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"--amend option copies authorship">)} 
      {
        (SQ <"\n"> <"\tgit checkout Initial &&\n"> <"\techo \"Test 5\" >>foo &&\n"> <"\ttest_tick &&\n"> 
          <"\tgit commit -a --amend -m \"amend test\" &&\n"> <"\tauthor_header Initial >expect &&\n"> <"\tauthor_header HEAD >actual &&\n"> 
          <"\ttest_cmp expect actual &&\n"> <"\n"> <"\techo \"amend test\" >expect &&\n"> <"\tmessage_body HEAD >actual &&\n"> 
          <"\ttest_cmp expect actual\n">
        )
      }
    )
    (FuncDef
      name: sha1_file
      body: 
        (BraceGroup
          children: [
            (Pipeline
              children: [
                (C {(echo)} {(DQ ($ VSub_Star "$*"))})
                (C {(sed)} {(DQ ("s#..#.git/objects/&/#"))})
              ]
              negated: False
            )
          ]
          spids: [207]
        )
      spids: [203 206]
    )
    (FuncDef
      name: remove_object
      body: 
        (BraceGroup
          children: [
            (C {(rm)} {(-f)} 
              {
                (CommandSubPart
                  command_list: (CommandList children:[(C {(sha1_file)} {(DQ ($ VSub_Star "$*"))})])
                  left_token: <Left_CommandSub "$(">
                  spids: [237 243]
                )
              }
            )
          ]
          spids: [230]
        )
      spids: [226 229]
    )
    (C {(test_expect_success)} {(SQ <"--amend option with empty author">)} 
      {
        (SQ <"\n"> <"\tgit cat-file commit Initial >tmp &&\n"> 
          <"\tsed \"s/author [^<]* </author  </\" tmp >empty-author &&\n"> <"\tsha=$(git hash-object -t commit -w empty-author) &&\n"> 
          <"\ttest_when_finished \"remove_object $sha\" &&\n"> <"\tgit checkout $sha &&\n"> <"\ttest_when_finished \"git checkout Initial\" &&\n"> 
          <"\techo \"Empty author test\" >>foo &&\n"> <"\ttest_tick &&\n"> <"\ttest_must_fail git commit -a -m \"empty author\" --amend 2>err &&\n"> 
          <"\tgrep \"empty ident\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"--amend option with missing author">)} 
      {
        (SQ <"\n"> <"\tgit cat-file commit Initial >tmp &&\n"> 
          <"\tsed \"s/author [^<]* </author </\" tmp >malformed &&\n"> <"\tsha=$(git hash-object -t commit -w malformed) &&\n"> 
          <"\ttest_when_finished \"remove_object $sha\" &&\n"> <"\tgit checkout $sha &&\n"> <"\ttest_when_finished \"git checkout Initial\" &&\n"> 
          <"\techo \"Missing author test\" >>foo &&\n"> <"\ttest_tick &&\n"> <"\ttest_must_fail git commit -a -m \"malformed author\" --amend 2>err &&\n"> 
          <"\tgrep \"empty ident\" err\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"--reset-author makes the commit ours even with --amend option">)} 
      {
        (SQ <"\n"> <"\tgit checkout Initial &&\n"> <"\techo \"Test 6\" >>foo &&\n"> <"\ttest_tick &&\n"> 
          <"\tgit commit -a --reset-author -m \"Changed again\" --amend &&\n"> <"\techo \"author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> $GIT_AUTHOR_DATE\" >expect &&\n"> 
          <"\tauthor_header HEAD >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\n"> <"\techo \"Changed again\" >expect &&\n"> 
          <"\tmessage_body HEAD >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"--reset-author and --author are mutually exclusive">)} 
      {
        (SQ <"\n"> <"\tgit checkout Initial &&\n"> <"\techo \"Test 7\" >>foo &&\n"> <"\ttest_tick &&\n"> 
          <"\ttest_must_fail git commit -a --reset-author --author=\"Xyzzy <frotz@nitfol.xz>\"\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"--reset-author should be rejected without -c/-C/--amend">)} 
      {
        (SQ <"\n"> <"\tgit checkout Initial &&\n"> <"\techo \"Test 7\" >>foo &&\n"> <"\ttest_tick &&\n"> 
          <"\ttest_must_fail git commit -a --reset-author -m done\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"commit respects CHERRY_PICK_HEAD and MERGE_MSG">)} 
      {
        (SQ <"\n"> <"\techo \"cherry-pick 1a\" >>foo &&\n"> <"\ttest_tick &&\n"> 
          <"\tgit commit -am \"cherry-pick 1\" --author=\"Cherry <cherry@pick.er>\" &&\n"> <"\tgit tag cherry-pick-head &&\n"> <"\tgit rev-parse cherry-pick-head >.git/CHERRY_PICK_HEAD &&\n"> 
          <"\techo \"This is a MERGE_MSG\" >.git/MERGE_MSG &&\n"> <"\techo \"cherry-pick 1b\" >>foo &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -a &&\n"> 
          <"\tauthor_header cherry-pick-head >expect &&\n"> <"\tauthor_header HEAD >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\n"> 
          <"\techo \"This is a MERGE_MSG\" >expect &&\n"> <"\tmessage_body HEAD >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"--reset-author with CHERRY_PICK_HEAD">)} 
      {
        (SQ <"\n"> <"\tgit rev-parse cherry-pick-head >.git/CHERRY_PICK_HEAD &&\n"> 
          <"\techo \"cherry-pick 2\" >>foo &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -am \"cherry-pick 2\" --reset-author &&\n"> 
          <"\techo \"author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> $GIT_AUTHOR_DATE\" >expect &&\n"> <"\tauthor_header HEAD >actual &&\n"> <"\ttest_cmp expect actual\n">
        )
      }
    )
    (C {(test_done)})
  ]
)