(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: 
            {
              (SQ <'Three way merge with read-tree -m\n'> <'\n'> 
                <'This test tries three-way merge with read-tree -m\n'> <'\n'> <'There is one ancestor (called O for Original) and two branches A\n'> 
                <'and B derived from it.  We want to do a 3-way merge between A and\n'> <'B, using O as the common ancestor.\n'> <'\n'> <'    merge A O B\n'> <'\n'> 
                <'Decisions are made by comparing contents of O, A and B pathname\n'> <'by pathname.  The result is determined by the following guiding\n'> <'principle:\n'> <'\n'> 
                <' - If only A does something to it and B does not touch it, take\n'> <'   whatever A does.\n'> <'\n'> <' - If only B does something to it and A does not touch it, take\n'> 
                <'   whatever B does.\n'> <'\n'> <' - If both A and B does something but in the same way, take\n'> <'   whatever they do.\n'> 
                <'\n'> <' - If A and B does something but different things, we need a\n'> <'   3-way merge:\n'> <'\n'> 
                <'   - We cannot do anything about the following cases:\n'> <'\n'> <'     * O does not have it.  A and B both must be adding to the\n'> 
                <'       same path independently.\n'> <'\n'> <'     * A deletes it.  B must be modifying.\n'> <'\n'> 
                <'   - Otherwise, A and B are modifying.  Run 3-way merge.\n'> <'\n'> <'First, the case matrix.\n'> <'\n'> <' - Vertical axis is for A'>
              ) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) 
              (SQ <'s actions.\n'> <' - Horizontal axis is for B'>) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) 
              (SQ <'s actions.\n'> <'\n'> 
                <'.----------------------------------------------------------------.\n'> <'| A        B | No Action  |   Delete   |   Modify   |    Add     |\n'> 
                <'|------------+------------+------------+------------+------------|\n'> <'| No Action  |            |            |            |            |\n'> 
                <'|            | select O   | delete     | select B   | select B   |\n'> <'|            |            |            |            |            |\n'> 
                <'|------------+------------+------------+------------+------------|\n'> <'| Delete     |            |            | ********** |    can     |\n'> 
                <'|            | delete     | delete     | merge      |    not     |\n'> <'|            |            |            |            |  happen    |\n'> 
                <'|------------+------------+------------+------------+------------|\n'> <'| Modify     |            | ********** | ?????????? |    can     |\n'> 
                <'|            | select A   | merge      | select A=B |    not     |\n'> <'|            |            |            | merge      |  happen    |\n'> 
                <'|------------+------------+------------+------------+------------|\n'> <'| Add        |            |    can     |    can     | ?????????? |\n'> 
                <'|            | select A   |    not     |    not     | select A=B |\n'> <'|            |            |  happen    |  happen    | merge      |\n'> 
                <'.----------------------------------------------------------------.\n'> <'\n'> <'In addition:\n'> <'\n'> 
                <' SS: a special case of MM, where A and B makes the same modification.\n'> <' LL: a special case of AA, where A and B creates the same file.\n'> 
                <' TT: a special case of MM, where A and B makes mergeable changes.\n'> <' DF: a special case, where A makes a directory and B makes a file.\n'> <'\n'>
              )
            }
          spids: [13]
        )
      ]
      spids: [13]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(.)} {(DQ ($ VSub_Name '$TEST_DIRECTORY')) (/lib-read-tree.sh)})
    (C {(.)} {(DQ ($ VSub_Name '$TEST_DIRECTORY')) (/lib-read-tree-m-3way.sh)})
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:16777215 arg_word:{(expected)} spids:[123])
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: 
            {('100644 X 2\tAA\n') ('100644 X 3\tAA\n') ('100644 X 0\tAN\n') ('100644 X 1\tDD\n') 
              ('100644 X 3\tDF\n') ('100644 X 2\tDF/DF\n') ('100644 X 1\tDM\n') ('100644 X 3\tDM\n') ('100644 X 1\tDN\n') 
              ('100644 X 3\tDN\n') ('100644 X 0\tLL\n') ('100644 X 1\tMD\n') ('100644 X 2\tMD\n') ('100644 X 1\tMM\n') ('100644 X 2\tMM\n') 
              ('100644 X 3\tMM\n') ('100644 X 0\tMN\n') ('100644 X 0\tNA\n') ('100644 X 1\tND\n') ('100644 X 2\tND\n') ('100644 X 0\tNM\n') 
              ('100644 X 0\tNN\n') ('100644 X 0\tSS\n') ('100644 X 1\tTT\n') ('100644 X 2\tTT\n') ('100644 X 3\tTT\n') 
              ('100644 X 2\tZ/AA\n') ('100644 X 3\tZ/AA\n') ('100644 X 0\tZ/AN\n') ('100644 X 1\tZ/DD\n') ('100644 X 1\tZ/DM\n') 
              ('100644 X 3\tZ/DM\n') ('100644 X 1\tZ/DN\n') ('100644 X 3\tZ/DN\n') ('100644 X 1\tZ/MD\n') ('100644 X 2\tZ/MD\n') 
              ('100644 X 1\tZ/MM\n') ('100644 X 2\tZ/MM\n') ('100644 X 3\tZ/MM\n') ('100644 X 0\tZ/MN\n') ('100644 X 0\tZ/NA\n') 
              ('100644 X 1\tZ/ND\n') ('100644 X 2\tZ/ND\n') ('100644 X 0\tZ/NM\n') ('100644 X 0\tZ/NN\n')
            }
          do_expansion: False
          here_end: EOF
          was_filled: T
          spids: [126]
        )
      ]
    )
    (FuncDef
      name: check_result
      body: 
        (BraceGroup
          children: [
            (AndOr
              ops: [Op_DAmp]
              children: [
                (Pipeline
                  children: [
                    (C {(git)} {(ls-files)} {(--stage)})
                    (SimpleCommand
                      words: [{(sed)} {(-e)} {(SQ <'s/ '>) (DQ ($ VSub_Name '$_x40')) (SQ <' / X /'>)}]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: 16777215
                          arg_word: {(current)}
                          spids: [161]
                        )
                      ]
                    )
                  ]
                  negated: F
                )
                (C {(test_cmp)} {(expected)} {(current)})
              ]
            )
          ]
          spids: [136]
        )
      spids: [131 135]
    )
    (C {(test_expect_success)} {(SQ <'3-way merge with git read-tree -m, empty cache'>)} 
      {
        (DQ ('rm -fr [NDMALTS][NDMALTSF] Z &&\n') ('     rm .git/index &&\n') 
          ('     read_tree_must_succeed -m ') ($ VSub_Name '$tree_O') (' ') ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') (' &&\n') 
          ('     check_result')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'3-way merge with git read-tree -m, match H'>)} 
      {
        (DQ ('rm -fr [NDMALTS][NDMALTSF] Z &&\n') ('     rm .git/index &&\n') 
          ('     read_tree_must_succeed ') ($ VSub_Name '$tree_A') (' &&\n') ('     git checkout-index -f -u -a &&\n') 
          ('     read_tree_must_succeed -m ') ($ VSub_Name '$tree_O') (' ') ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') (' &&\n') 
          ('     check_result')
        )
      }
    )
    (SimpleCommand
      words: [{(Lit_Other ':')}]
      redirects: [
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: 
            {('\n') ('We have so far tested only empty index and clean-and-matching-A index\n') 
              ('case which are trivial.  Make sure index requirements are also\n') ('checked.\n') ('\n') ('"git read-tree -m O A B"\n') ('\n') 
              ('     O       A       B         result      index requirements\n') ('-------------------------------------------------------------------\n') 
              ('  1  missing missing missing   -           must not exist.\n') (' ------------------------------------------------------------------\n') 
              ('  2  missing missing exists    take B*     must match B, if exists.\n') (' ------------------------------------------------------------------\n') 
              ('  3  missing exists  missing   take A*     must match A, if exists.\n') (' ------------------------------------------------------------------\n') 
              ('  4  missing exists  A!=B      no merge    must match A and be\n') ('                                           up-to-date, if exists.\n') 
              (' ------------------------------------------------------------------\n') ('  5  missing exists  A==B      take A      must match A, if exists.\n') 
              (' ------------------------------------------------------------------\n') ('  6  exists  missing missing   remove      must not exist.\n') 
              (' ------------------------------------------------------------------\n') ('  7  exists  missing O!=B      no merge    must not exist.\n') 
              (' ------------------------------------------------------------------\n') ('  8  exists  missing O==B      remove      must not exist.\n') 
              (' ------------------------------------------------------------------\n') ('  9  exists  O!=A    missing   no merge    must match A and be\n') 
              ('                                           up-to-date, if exists.\n') (' ------------------------------------------------------------------\n') 
              (' 10  exists  O==A    missing   no merge    must match A\n') (' ------------------------------------------------------------------\n') 
              (' 11  exists  O!=A    O!=B      no merge    must match A and be\n') ('                     A!=B                  up-to-date, if exists.\n') 
              (' ------------------------------------------------------------------\n') (' 12  exists  O!=A    O!=B      take A      must match A, if exists.\n') 
              ('                     A==B\n') (' ------------------------------------------------------------------\n') 
              (' 13  exists  O!=A    O==B      take A      must match A, if exists.\n') (' ------------------------------------------------------------------\n') 
              (' 14  exists  O==A    O!=B      take B      if exists, must either (1)\n') ('                                           match A and be up-to-date,\n') 
              ('                                           or (2) match B.\n') (' ------------------------------------------------------------------\n') 
              (' 15  exists  O==A    O==B      take B      must match A if exists.\n') (' ------------------------------------------------------------------\n') 
              (' 16  exists  O==A    O==B      barf        must match A if exists.\n') ('     *multi* in one  in another\n') 
              ('-------------------------------------------------------------------\n') ('\n') ('Note: we need to be careful in case 2 and 3.  The tree A may contain\n') 
              ('DF (file) when tree B require DF to be a directory by having DF/DF\n') ('(file).\n') ('\n')
            }
          do_expansion: False
          here_end: END_OF_CASE_TABLE
          was_filled: T
          spids: [242]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'1 - must not have an entry not in A.'>)} 
      {
        (DQ ('\n') ('     rm -f .git/index XX &&\n') ('     echo XX >XX &&\n') 
          ('     git update-index --add XX &&\n') ('     read_tree_must_fail -m ') ($ VSub_Name '$tree_O') (' ') ($ VSub_Name '$tree_A') (' ') 
          ($ VSub_Name '$tree_B') ('\n')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'2 - must match B in !O && !A && B case.'>)} 
      {
        (DQ ('rm -f .git/index NA &&\n') ('     cp .orig-B/NA NA &&\n') 
          ('     git update-index --add NA &&\n') ('     read_tree_must_succeed -m ') ($ VSub_Name '$tree_O') (' ') ($ VSub_Name '$tree_A') (' ') 
          ($ VSub_Name '$tree_B')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'2 - matching B alone is OK in !O && !A && B case.'>)} 
      {
        (DQ ('rm -f .git/index NA &&\n') ('     cp .orig-B/NA NA &&\n') 
          ('     git update-index --add NA &&\n') ('     echo extra >>NA &&\n') ('     read_tree_must_succeed -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'3 - must match A in !O && A && !B case.'>)} 
      {
        (DQ ('rm -f .git/index AN &&\n') ('     cp .orig-A/AN AN &&\n') 
          ('     git update-index --add AN &&\n') ('     read_tree_must_succeed -m ') ($ VSub_Name '$tree_O') (' ') ($ VSub_Name '$tree_A') (' ') 
          ($ VSub_Name '$tree_B') (' &&\n') ('     check_result')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'3 - matching A alone is OK in !O && A && !B case.'>)} 
      {
        (DQ ('rm -f .git/index AN &&\n') ('     cp .orig-A/AN AN &&\n') 
          ('     git update-index --add AN &&\n') ('     echo extra >>AN &&\n') ('     read_tree_must_succeed -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'3 (fail) - must match A in !O && A && !B case.'>)} 
      {
        (DQ ('\n') ('     rm -f .git/index AN &&\n') ('     cp .orig-A/AN AN &&\n') 
          ('     echo extra >>AN &&\n') ('     git update-index --add AN &&\n') ('     read_tree_must_fail -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') ('\n')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'4 - must match and be up-to-date in !O && A && B && A!=B case.'>)} 
      {
        (DQ ('rm -f .git/index AA &&\n') ('     cp .orig-A/AA AA &&\n') 
          ('     git update-index --add AA &&\n') ('     read_tree_must_succeed -m ') ($ VSub_Name '$tree_O') (' ') ($ VSub_Name '$tree_A') (' ') 
          ($ VSub_Name '$tree_B') (' &&\n') ('     check_result')
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.'>)} 
      {
        (DQ ('\n') ('     rm -f .git/index AA &&\n') ('     cp .orig-A/AA AA &&\n') 
          ('     git update-index --add AA &&\n') ('     echo extra >>AA &&\n') ('     read_tree_must_fail -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') ('\n')
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.'>)} 
      {
        (DQ ('\n') ('     rm -f .git/index AA &&\n') ('     cp .orig-A/AA AA &&\n') 
          ('     echo extra >>AA &&\n') ('     git update-index --add AA &&\n') ('     read_tree_must_fail -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') ('\n')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'5 - must match in !O && A && B && A==B case.'>)} 
      {
        (DQ ('rm -f .git/index LL &&\n') ('     cp .orig-A/LL LL &&\n') 
          ('     git update-index --add LL &&\n') ('     read_tree_must_succeed -m ') ($ VSub_Name '$tree_O') (' ') ($ VSub_Name '$tree_A') (' ') 
          ($ VSub_Name '$tree_B') (' &&\n') ('     check_result')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'5 - must match in !O && A && B && A==B case.'>)} 
      {
        (DQ ('rm -f .git/index LL &&\n') ('     cp .orig-A/LL LL &&\n') 
          ('     git update-index --add LL &&\n') ('     echo extra >>LL &&\n') ('     read_tree_must_succeed -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') (' &&\n') ('     check_result')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'5 (fail) - must match A in !O && A && B && A==B case.'>)} 
      {
        (DQ ('\n') ('     rm -f .git/index LL &&\n') ('     cp .orig-A/LL LL &&\n') 
          ('     echo extra >>LL &&\n') ('     git update-index --add LL &&\n') ('     read_tree_must_fail -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') ('\n')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'6 - must not exist in O && !A && !B case'>)} 
      {
        (DQ ('\n') ('     rm -f .git/index DD &&\n') ('     echo DD >DD &&\n') 
          ('     git update-index --add DD &&\n') ('     read_tree_must_fail -m ') ($ VSub_Name '$tree_O') (' ') ($ VSub_Name '$tree_A') (' ') 
          ($ VSub_Name '$tree_B') ('\n')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'7 - must not exist in O && !A && B && O!=B case'>)} 
      {
        (DQ ('\n') ('     rm -f .git/index DM &&\n') ('     cp .orig-B/DM DM &&\n') 
          ('     git update-index --add DM &&\n') ('     read_tree_must_fail -m ') ($ VSub_Name '$tree_O') (' ') ($ VSub_Name '$tree_A') (' ') 
          ($ VSub_Name '$tree_B') ('\n')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'8 - must not exist in O && !A && B && O==B case'>)} 
      {
        (DQ ('\n') ('     rm -f .git/index DN &&\n') ('     cp .orig-B/DN DN &&\n') 
          ('     git update-index --add DN &&\n') ('     read_tree_must_fail -m ') ($ VSub_Name '$tree_O') (' ') ($ VSub_Name '$tree_A') (' ') 
          ($ VSub_Name '$tree_B') ('\n')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'9 - must match and be up-to-date in O && A && !B && O!=A case'>)} 
      {
        (DQ ('rm -f .git/index MD &&\n') ('     cp .orig-A/MD MD &&\n') 
          ('     git update-index --add MD &&\n') ('     read_tree_must_succeed -m ') ($ VSub_Name '$tree_O') (' ') ($ VSub_Name '$tree_A') (' ') 
          ($ VSub_Name '$tree_B') (' &&\n') ('     check_result')
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'9 (fail) - must match and be up-to-date in O && A && !B && O!=A case'>)} 
      {
        (DQ ('\n') ('     rm -f .git/index MD &&\n') ('     cp .orig-A/MD MD &&\n') 
          ('     git update-index --add MD &&\n') ('     echo extra >>MD &&\n') ('     read_tree_must_fail -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') ('\n')
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'9 (fail) - must match and be up-to-date in O && A && !B && O!=A case'>)} 
      {
        (DQ ('\n') ('     rm -f .git/index MD &&\n') ('     cp .orig-A/MD MD &&\n') 
          ('     echo extra >>MD &&\n') ('     git update-index --add MD &&\n') ('     read_tree_must_fail -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') ('\n')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'10 - must match and be up-to-date in O && A && !B && O==A case'>)} 
      {
        (DQ ('rm -f .git/index ND &&\n') ('     cp .orig-A/ND ND &&\n') 
          ('     git update-index --add ND &&\n') ('     read_tree_must_succeed -m ') ($ VSub_Name '$tree_O') (' ') ($ VSub_Name '$tree_A') (' ') 
          ($ VSub_Name '$tree_B') (' &&\n') ('     check_result')
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'10 (fail) - must match and be up-to-date in O && A && !B && O==A case'>)} 
      {
        (DQ ('\n') ('     rm -f .git/index ND &&\n') ('     cp .orig-A/ND ND &&\n') 
          ('     git update-index --add ND &&\n') ('     echo extra >>ND &&\n') ('     read_tree_must_fail -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') ('\n')
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'10 (fail) - must match and be up-to-date in O && A && !B && O==A case'>)} 
      {
        (DQ ('\n') ('     rm -f .git/index ND &&\n') ('     cp .orig-A/ND ND &&\n') 
          ('     echo extra >>ND &&\n') ('     git update-index --add ND &&\n') ('     read_tree_must_fail -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') ('\n')
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'11 - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case'>)} 
      {
        (DQ ('rm -f .git/index MM &&\n') ('     cp .orig-A/MM MM &&\n') 
          ('     git update-index --add MM &&\n') ('     read_tree_must_succeed -m ') ($ VSub_Name '$tree_O') (' ') ($ VSub_Name '$tree_A') (' ') 
          ($ VSub_Name '$tree_B') (' &&\n') ('     check_result')
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case'>)} 
      {
        (DQ ('\n') ('     rm -f .git/index MM &&\n') ('     cp .orig-A/MM MM &&\n') 
          ('     git update-index --add MM &&\n') ('     echo extra >>MM &&\n') ('     read_tree_must_fail -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') ('\n')
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case'>)} 
      {
        (DQ ('\n') ('     rm -f .git/index MM &&\n') ('     cp .orig-A/MM MM &&\n') 
          ('     echo extra >>MM &&\n') ('     git update-index --add MM &&\n') ('     read_tree_must_fail -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') ('\n')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'12 - must match A in O && A && B && O!=A && A==B case'>)} 
      {
        (DQ ('rm -f .git/index SS &&\n') ('     cp .orig-A/SS SS &&\n') 
          ('     git update-index --add SS &&\n') ('     read_tree_must_succeed -m ') ($ VSub_Name '$tree_O') (' ') ($ VSub_Name '$tree_A') (' ') 
          ($ VSub_Name '$tree_B') (' &&\n') ('     check_result')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'12 - must match A in O && A && B && O!=A && A==B case'>)} 
      {
        (DQ ('rm -f .git/index SS &&\n') ('     cp .orig-A/SS SS &&\n') 
          ('     git update-index --add SS &&\n') ('     echo extra >>SS &&\n') ('     read_tree_must_succeed -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') (' &&\n') ('     check_result')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'12 (fail) - must match A in O && A && B && O!=A && A==B case'>)} 
      {
        (DQ ('\n') ('     rm -f .git/index SS &&\n') ('     cp .orig-A/SS SS &&\n') 
          ('     echo extra >>SS &&\n') ('     git update-index --add SS &&\n') ('     read_tree_must_fail -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') ('\n')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'13 - must match A in O && A && B && O!=A && O==B case'>)} 
      {
        (DQ ('rm -f .git/index MN &&\n') ('     cp .orig-A/MN MN &&\n') 
          ('     git update-index --add MN &&\n') ('     read_tree_must_succeed -m ') ($ VSub_Name '$tree_O') (' ') ($ VSub_Name '$tree_A') (' ') 
          ($ VSub_Name '$tree_B') (' &&\n') ('     check_result')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'13 - must match A in O && A && B && O!=A && O==B case'>)} 
      {
        (DQ ('rm -f .git/index MN &&\n') ('     cp .orig-A/MN MN &&\n') 
          ('     git update-index --add MN &&\n') ('     echo extra >>MN &&\n') ('     read_tree_must_succeed -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') (' &&\n') ('     check_result')
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'14 - must match and be up-to-date in O && A && B && O==A && O!=B case'>)} 
      {
        (DQ ('rm -f .git/index NM &&\n') ('     cp .orig-A/NM NM &&\n') 
          ('     git update-index --add NM &&\n') ('     read_tree_must_succeed -m ') ($ VSub_Name '$tree_O') (' ') ($ VSub_Name '$tree_A') (' ') 
          ($ VSub_Name '$tree_B') (' &&\n') ('     check_result')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'14 - may match B in O && A && B && O==A && O!=B case'>)} 
      {
        (DQ ('rm -f .git/index NM &&\n') ('     cp .orig-B/NM NM &&\n') 
          ('     git update-index --add NM &&\n') ('     echo extra >>NM &&\n') ('     read_tree_must_succeed -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') (' &&\n') ('     check_result')
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case'>)} 
      {
        (DQ ('\n') ('     rm -f .git/index NM &&\n') ('     cp .orig-A/NM NM &&\n') 
          ('     git update-index --add NM &&\n') ('     echo extra >>NM &&\n') ('     read_tree_must_fail -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') ('\n')
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ <'14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case'>)} 
      {
        (DQ ('\n') ('     rm -f .git/index NM &&\n') ('     cp .orig-A/NM NM &&\n') 
          ('     echo extra >>NM &&\n') ('     git update-index --add NM &&\n') ('     read_tree_must_fail -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') ('\n')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'15 - must match A in O && A && B && O==A && O==B case'>)} 
      {
        (DQ ('rm -f .git/index NN &&\n') ('     cp .orig-A/NN NN &&\n') 
          ('     git update-index --add NN &&\n') ('     read_tree_must_succeed -m ') ($ VSub_Name '$tree_O') (' ') ($ VSub_Name '$tree_A') (' ') 
          ($ VSub_Name '$tree_B') (' &&\n') ('     check_result')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'15 - must match A in O && A && B && O==A && O==B case'>)} 
      {
        (DQ ('rm -f .git/index NN &&\n') ('     cp .orig-A/NN NN &&\n') 
          ('     git update-index --add NN &&\n') ('     echo extra >>NN &&\n') ('     read_tree_must_succeed -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') (' &&\n') ('     check_result')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'15 (fail) - must match A in O && A && B && O==A && O==B case'>)} 
      {
        (DQ ('\n') ('     rm -f .git/index NN &&\n') ('     cp .orig-A/NN NN &&\n') 
          ('     echo extra >>NN &&\n') ('     git update-index --add NN &&\n') ('     read_tree_must_fail -m ') ($ VSub_Name '$tree_O') (' ') 
          ($ VSub_Name '$tree_A') (' ') ($ VSub_Name '$tree_B') ('\n')
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'16 - A matches in one and B matches in another.'>)} 
      {
        (SQ <'rm -f .git/index F16 &&\n'> <'    echo F16 >F16 &&\n'> 
          <'    git update-index --add F16 &&\n'> <'    tree0=$(git write-tree) &&\n'> <'    echo E16 >F16 &&\n'> <'    git update-index F16 &&\n'> 
          <'    tree1=$(git write-tree) &&\n'> <'    read_tree_must_succeed -m $tree0 $tree1 $tree1 $tree0 &&\n'> <'    git ls-files --stage'>
        )
      }
    )
    (C {(test_done)})
  ]
)