(command.CommandList
  children: [
    (command.ShFunction
      name: set_fake_editor
      body: 
        (command.BraceGroup
          children: [
            (command.Simple
              words: [{(write_script)} {(fake-editor.sh)}]
              redirects: [
                (redir.HereDoc
                  op: (Token id:Id.Redir_DLessDash val:'<<-' span_id:83)
                  fd: -1
                  here_begin: 
                    {
                      (word_part.EscapedLiteral
                        token: (Token id:Id.Lit_EscapedChar val:'\\E' span_id:84)
                      ) (OF)
                    }
                  here_end_span_id: 129
                  stdin_parts: [
                    ('case "$1" in\n')
                    ('*/COMMIT_EDITMSG)\n')
                    ('test -z "$EXPECT_HEADER_COUNT" ||\n')
                    (
'test "$EXPECT_HEADER_COUNT" = "$(sed -n \'1s/^# This is a combination of \\(.*\\) commits\\./\\1/p\' < "$1")" ||\n'
                    )
                    ('test "# # GETTEXT POISON #" = "$(sed -n \'1p\' < "$1")" ||\n')
                    ('exit\n')
                    ('test -z "$FAKE_COMMIT_MESSAGE" || echo "$FAKE_COMMIT_MESSAGE" > "$1"\n')
                    ('test -z "$FAKE_COMMIT_AMEND" || echo "$FAKE_COMMIT_AMEND" >> "$1"\n')
                    ('exit\n')
                    (';;\n')
                    ('esac\n')
                    ('test -z "$EXPECT_COUNT" ||\n')
                    ('test "$EXPECT_COUNT" = $(sed -e \'/^#/d\' -e \'/^$/d\' < "$1" | wc -l) ||\n')
                    ('exit\n')
                    ('test -z "$FAKE_LINES" && exit\n')
                    ('grep -v \'^#\' < "$1" > "$1".tmp\n')
                    ('rm -f "$1"\n')
                    ("echo 'rebase -i script before editing:'\n")
                    ('cat "$1".tmp\n')
                    ('action=pick\n')
                    ('for line in $FAKE_LINES; do\n')
                    ('case $line in\n')
                    ('squash|fixup|edit|reword|drop)\n')
                    ('action="$line";;\n')
                    ('exec*)\n')
                    ('echo "$line" | sed \'s/_/ /g\' >> "$1";;\n')
                    ('"#")\n')
                    ('echo \'# comment\' >> "$1";;\n')
                    ('">")\n')
                    ('echo >> "$1";;\n')
                    ('bad)\n')
                    ('action="badcmd";;\n')
                    ('fakesha)\n')
                    ('echo "$action XXXXXXX False commit" >> "$1"\n')
                    ('action=pick;;\n')
                    ('*)\n')
                    ('sed -n "${line}s/^pick/$action/p" < "$1".tmp >> "$1"\n')
                    ('action=pick;;\n')
                    ('esac\n')
                    ('done\n')
                    ("echo 'rebase -i script after editing:'\n")
                    ('cat "$1"\n')
                  ]
                )
              ]
            )
            (C {(test_set_editor)} 
              {
                (DQ 
                  (command_sub
                    left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:135)
                    command_list: (command.CommandList children:[(C {(pwd)})])
                  ) (/fake-editor.sh)
                )
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: set_cat_todo_editor
      body: 
        (command.BraceGroup
          children: [
            (command.Simple
              words: [{(write_script)} {(fake-editor.sh)}]
              redirects: [
                (redir.HereDoc
                  op: (Token id:Id.Redir_DLessDash val:'<<-' span_id:172)
                  fd: -1
                  here_begin: 
                    {
                      (word_part.EscapedLiteral
                        token: (Token id:Id.Lit_EscapedChar val:'\\E' span_id:173)
                      ) (OF)
                    }
                  here_end_span_id: 178
                  stdin_parts: [('grep "^[^#]" "$1"\n') ('exit 1\n')]
                )
              ]
            )
            (C {(test_set_editor)} 
              {
                (DQ 
                  (command_sub
                    left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:183)
                    command_list: (command.CommandList children:[(C {(pwd)})])
                  ) (/fake-editor.sh)
                )
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: test_linear_range
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp]
              children: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:revlist_merges)
                      op: assign_op.Equal
                      rhs: 
                        {
                          (command_sub
                            left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:207)
                            command_list: 
                              (command.CommandList
                                children: [
                                  (C {(git)} {(rev-list)} {(--merges)} {(DQ ($ Id.VSub_Number '$2'))})
                                ]
                              )
                          )
                        }
                      spids: [206]
                    )
                  ]
                )
                (C {(test)} {(-z)} {(DQ ($ Id.VSub_DollarName '$revlist_merges'))})
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:expected)
                      op: assign_op.Equal
                      rhs: {($ Id.VSub_Number '$1')}
                      spids: [233]
                    )
                  ]
                )
              ]
            )
            (C {(Id.KW_Set set)} {(--)} 
              {
                (command_sub
                  left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:241)
                  command_list: 
                    (command.CommandList
                      children: [
                        (C {(git)} {(log)} {(--reverse)} 
                          {(--format) (Id.Lit_Equals '=') (Id.Lit_Other '%') (s)} {(DQ ($ Id.VSub_Number '$2'))}
                        )
                      ]
                    )
                )
              }
            )
            (C {(test)} {(DQ ($ Id.VSub_DollarName '$expected'))} {(Id.Lit_Equals '=')} 
              {(DQ ($ Id.VSub_Star '$*'))}
            )
          ]
        )
    )
    (command.ShFunction
      name: reset_rebase
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp]
              children: [
                (C {(test_might_fail)} {(git)} {(rebase)} {(--abort)})
                (C {(git)} {(reset)} {(--hard)})
                (C {(git)} {(clean)} {(-f)})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: cherry_pick
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp]
              children: [
                (C {(git)} {(cherry-pick)} {(-n)} {(DQ ($ Id.VSub_Number '$2'))})
                (C {(git)} {(commit)} {(-m)} {(DQ ($ Id.VSub_Number '$1'))})
                (C {(git)} {(tag)} {(DQ ($ Id.VSub_Number '$1'))})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: revert
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp]
              children: [
                (C {(git)} {(revert)} {(-n)} {(DQ ($ Id.VSub_Number '$2'))})
                (C {(git)} {(commit)} {(-m)} {(DQ ($ Id.VSub_Number '$1'))})
                (C {(git)} {(tag)} {(DQ ($ Id.VSub_Number '$1'))})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: make_empty
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (C {(git)} {(commit)} {(--allow-empty)} {(-m)} {(DQ ($ Id.VSub_Number '$1'))})
                (C {(git)} {(tag)} {(DQ ($ Id.VSub_Number '$1'))})
              ]
            )
          ]
        )
    )
  ]
)