We're losing the safety that ensured HEAD was actually a commit.  Its been seen in real-world cases that users have managed to do something stupid and set HEAD to a tag or a tree.  Blindly assuming HEAD is a commit can only lead to data corruption when things go bad.

Either keep the repo.resolve call, or do some sort of object lookup on the ObjectId to verify its actually a commit.  E.g.:

  if (headId != null) {
    ObjectLoader ldr = repo.openObject(headId);
    if (ldr == null)
      throw new MissingObjectException(headId, Constants.OBJ_COMMIT);
    if (ldr.getType() != Constants.OBJ_COMMIT)
      throw new IncorrectObjectTypeException(headId, Constants.OBJ_COMMIT);
    parents.add(0, headId);
  }