If Head and Merge are equal by content and mode we will not touch index or file. Same is true if Head and Index are equal. I would add

  if (mId.equals(hId) && mMode == h.getEntryRawMode())
    keep(dce);
  if (mId.equals(iId) && mMode == iMode)
    keep(dce);