(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ (Token id:Id.Lit_Chars val:'merge: handle file mode' span_id:6))}
          spids: [4]
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'set up mode change in one branch' span_id:17))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:21) 
          (Token id:Id.Lit_Chars val:'\t: >file1 &&\n' span_id:22) (Token id:Id.Lit_Chars val:'\tgit add file1 &&\n' span_id:23) 
          (Token id:Id.Lit_Chars val:'\tgit commit -m initial &&\n' span_id:24) (Token id:Id.Lit_Chars val:'\tgit checkout -b a1 master &&\n' span_id:25) 
          (Token id:Id.Lit_Chars val:'\t: >dummy &&\n' span_id:26) (Token id:Id.Lit_Chars val:'\tgit add dummy &&\n' span_id:27) 
          (Token id:Id.Lit_Chars val:'\tgit commit -m a &&\n' span_id:28) (Token id:Id.Lit_Chars val:'\tgit checkout -b b1 master &&\n' span_id:29) 
          (Token id:Id.Lit_Chars val:'\ttest_chmod +x file1 &&\n' span_id:30) (Token id:Id.Lit_Chars val:'\tgit add file1 &&\n' span_id:31) 
          (Token id:Id.Lit_Chars val:'\tgit commit -m b1\n' span_id:32)
        )
      }
    )
    (command.ShFunction
      name: do_one_mode
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:strategy)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [44]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:us)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$2')}
                  spids: [48]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:them)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$3')}
                  spids: [52]
                )
              ]
            )
            (C {(test_expect_success)} 
              {
                (DQ ('resolve single mode change (') ($ Id.VSub_DollarName '$strategy') (', ') 
                  ($ Id.VSub_DollarName '$us') (')')
                )
              } 
              {
                (SQ (Token id:Id.Lit_Chars val:'\n' span_id:67) 
                  (Token
                    id: Id.Lit_Chars
                    val: '\t\tgit checkout -f $us &&\n'
                    span_id: 68
                  ) (Token id:Id.Lit_Chars val:'\t\tgit merge -s $strategy $them &&\n' span_id:69) 
                  (Token
                    id: Id.Lit_Chars
                    val: '\t\tgit ls-files -s file1 | grep ^100755\n'
                    span_id: 70
                  ) (Token id:Id.Lit_Chars val:'\t' span_id:71)
                )
              }
            )
            (C {(test_expect_success)} {(FILEMODE)} 
              {
                (DQ ('verify executable bit on file (') ($ Id.VSub_DollarName '$strategy') (', ') 
                  ($ Id.VSub_DollarName '$us') (')')
                )
              } 
              {
                (SQ (Token id:Id.Lit_Chars val:'\n' span_id:89) 
                  (Token id:Id.Lit_Chars val:'\t\ttest -x file1\n' span_id:90) (Token id:Id.Lit_Chars val:'\t' span_id:91)
                )
              }
            )
          ]
        )
    )
    (C {(do_one_mode)} {(recursive)} {(a1)} {(b1)})
    (C {(do_one_mode)} {(recursive)} {(b1)} {(a1)})
    (C {(do_one_mode)} {(resolve)} {(a1)} {(b1)})
    (C {(do_one_mode)} {(resolve)} {(b1)} {(a1)})
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'set up mode change in both branches' span_id:133))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:137) 
          (Token id:Id.Lit_Chars val:'\tgit reset --hard HEAD &&\n' span_id:138) (Token id:Id.Lit_Chars val:'\tgit checkout -b a2 master &&\n' span_id:139) 
          (Token id:Id.Lit_Chars val:'\t: >file2 &&\n' span_id:140) (Token id:Id.Lit_Chars val:'\tH=$(git hash-object file2) &&\n' span_id:141) 
          (Token id:Id.Lit_Chars val:'\ttest_chmod +x file2 &&\n' span_id:142) (Token id:Id.Lit_Chars val:'\tgit commit -m a2 &&\n' span_id:143) 
          (Token id:Id.Lit_Chars val:'\tgit checkout -b b2 master &&\n' span_id:144) (Token id:Id.Lit_Chars val:'\t: >file2 &&\n' span_id:145) 
          (Token id:Id.Lit_Chars val:'\tgit add file2 &&\n' span_id:146) (Token id:Id.Lit_Chars val:'\tgit commit -m b2 &&\n' span_id:147) 
          (Token id:Id.Lit_Chars val:'\t{\n' span_id:148) (Token id:Id.Lit_Chars val:'\t\techo "100755 $H 2\tfile2"\n' span_id:149) 
          (Token id:Id.Lit_Chars val:'\t\techo "100644 $H 3\tfile2"\n' span_id:150) (Token id:Id.Lit_Chars val:'\t} >expect\n' span_id:151)
        )
      }
    )
    (command.ShFunction
      name: do_both_modes
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:strategy)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [163]
                )
              ]
            )
            (C {(test_expect_success)} 
              {
                (DQ ('detect conflict on double mode change (') ($ Id.VSub_DollarName '$strategy') 
                  (')')
                )
              } 
              {
                (SQ (Token id:Id.Lit_Chars val:'\n' span_id:176) 
                  (Token
                    id: Id.Lit_Chars
                    val: '\t\tgit reset --hard &&\n'
                    span_id: 177
                  ) (Token id:Id.Lit_Chars val:'\t\tgit checkout -f a2 &&\n' span_id:178) 
                  (Token
                    id: Id.Lit_Chars
                    val: '\t\ttest_must_fail git merge -s $strategy b2 &&\n'
                    span_id: 179
                  ) (Token id:Id.Lit_Chars val:'\t\tgit ls-files -u >actual &&\n' span_id:180) 
                  (Token
                    id: Id.Lit_Chars
                    val: '\t\ttest_cmp actual expect &&\n'
                    span_id: 181
                  ) (Token id:Id.Lit_Chars val:'\t\tgit ls-files -s file2 | grep ^100755\n' span_id:182) 
                  (Token id:Id.Lit_Chars val:'\t' span_id:183)
                )
              }
            )
            (C {(test_expect_success)} {(FILEMODE)} 
              {(DQ ('verify executable bit on file (') ($ Id.VSub_DollarName '$strategy') (')'))} 
              {
                (SQ (Token id:Id.Lit_Chars val:'\n' span_id:199) 
                  (Token id:Id.Lit_Chars val:'\t\ttest -x file2\n' span_id:200) (Token id:Id.Lit_Chars val:'\t' span_id:201)
                )
              }
            )
          ]
        )
    )
    (C {(do_both_modes)} {(recursive)})
    (C {(do_both_modes)} {(resolve)})
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'set up delete/modechange scenario' span_id:222))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:226) 
          (Token id:Id.Lit_Chars val:'\tgit reset --hard &&\n' span_id:227) (Token id:Id.Lit_Chars val:'\tgit checkout -b deletion master &&\n' span_id:228) 
          (Token id:Id.Lit_Chars val:'\tgit rm file1 &&\n' span_id:229) (Token id:Id.Lit_Chars val:'\tgit commit -m deletion\n' span_id:230)
        )
      }
    )
    (command.ShFunction
      name: do_delete_modechange
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:strategy)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [242]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:us)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$2')}
                  spids: [246]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:them)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$3')}
                  spids: [250]
                )
              ]
            )
            (C {(test_expect_success)} 
              {
                (DQ ('detect delete/modechange conflict (') ($ Id.VSub_DollarName '$strategy') (', ') 
                  ($ Id.VSub_DollarName '$us') (')')
                )
              } 
              {
                (SQ (Token id:Id.Lit_Chars val:'\n' span_id:265) 
                  (Token
                    id: Id.Lit_Chars
                    val: '\t\tgit reset --hard &&\n'
                    span_id: 266
                  ) (Token id:Id.Lit_Chars val:'\t\tgit checkout $us &&\n' span_id:267) 
                  (Token
                    id: Id.Lit_Chars
                    val: '\t\ttest_must_fail git merge -s $strategy $them\n'
                    span_id: 268
                  ) (Token id:Id.Lit_Chars val:'\t' span_id:269)
                )
              }
            )
          ]
        )
    )
    (C {(do_delete_modechange)} {(recursive)} {(b1)} {(deletion)})
    (C {(do_delete_modechange)} {(recursive)} {(deletion)} {(b1)})
    (C {(do_delete_modechange)} {(resolve)} {(b1)} {(deletion)})
    (C {(do_delete_modechange)} {(resolve)} {(deletion)} {(b1)})
    (C {(test_done)})
  ]
)