(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:GRAFTS_FILE)
          op: assign_op.Equal
          rhs: 
            {
              (DQ 
                (braced_var_sub
                  token: (Token id:Id.VSub_Name val:GIT_DIR span_id:14)
                  suffix_op: (suffix_op.Unary op_id:Id.VTest_ColonHyphen arg_word:{(.git)})
                ) (/info/grafts)
              )
            }
          spids: [11]
        )
      ]
    )
    (C {(.)} 
      {
        (command_sub
          left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:24)
          command_list: (command.CommandList children:[(C {(git)} {(--exec-path)})])
        ) (/git-sh-setup)
      }
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {(test)} {(-f)} {(DQ ($ Id.VSub_DollarName '$GRAFTS_FILE'))})
        (C {(die)} {(DQ ("Could not find graft file: '") ($ Id.VSub_DollarName '$GRAFTS_FILE') ("'"))})
      ]
    )
    (command.Pipeline
      children: [
        (C {(grep)} {(SQ (Token id:Id.Lit_Chars val:'^[^# ]' span_id:54))} 
          {(DQ ($ Id.VSub_DollarName '$GRAFTS_FILE'))}
        )
        (command.WhileUntil
          keyword: (Token id:Id.KW_While val:while span_id:63)
          cond: [(C {(read)} {(definition)})]
          body: 
            (command.DoGroup
              children: [
                (command.If
                  arms: [
                    (if_arm
                      cond: [(C {(test)} {(-n)} {(DQ ($ Id.VSub_DollarName '$definition'))})]
                      action: [
                        (C {(echo)} {(DQ ('Converting: ') ($ Id.VSub_DollarName '$definition'))})
                        (command.AndOr
                          ops: [Id.Op_DPipe]
                          children: [
                            (C {(git)} {(replace)} {(--graft)} {($ Id.VSub_DollarName '$definition')})
                            (C {(die)} 
                              {(DQ ('Conversion failed for: ') ($ Id.VSub_DollarName '$definition'))}
                            )
                          ]
                        )
                      ]
                      spids: [72 83]
                    )
                  ]
                )
              ]
            )
        )
      ]
      negated: F
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {(mv)} {(DQ ($ Id.VSub_DollarName '$GRAFTS_FILE'))} 
          {(DQ ($ Id.VSub_DollarName '$GRAFTS_FILE') (.bak))}
        )
        (C {(die)} 
          {
            (DQ ("Could not rename '") ($ Id.VSub_DollarName '$GRAFTS_FILE') ("' to '") 
              ($ Id.VSub_DollarName '$GRAFTS_FILE') (".bak'")
            )
          }
        )
      ]
    )
    (C {(echo)} {(DQ ('Success!'))})
    (C {(echo)} 
      {
        (DQ ("All the grafts in '") ($ Id.VSub_DollarName '$GRAFTS_FILE') 
          ("' have been converted to replace refs!")
        )
      }
    )
    (C {(echo)} 
      {
        (DQ ("The grafts file '") ($ Id.VSub_DollarName '$GRAFTS_FILE') ("' has been renamed: '") 
          ($ Id.VSub_DollarName '$GRAFTS_FILE') (".bak'")
        )
      }
    )
  ]
)