See my note on ps2 again about an empty MERGE_HEAD file being a form of corruption.  But you may also be able to shorten the code up a bit here:

  File mergeHeadFile = new File(gitDir, Constants.MERGE_HEAD);
  byte[] raw;
  try {
    raw = IO.readFully(mergeHeadFile);
  } catch (FileNotFoundException notFound) {
    return new LinkedList<ObjectId>();
  }

  if (raw.length == 0)
    throw new IOException("MERGE_HEAD file empty: " + mergeHeadFile);

  LinkedList<ObjectId> heads = new LinkedList<ObjectId>();
  for (int p = 0; p < raw.length; ) {
    heads.add(ObjectId.fromString(raw, p));
    p = RawParseUtils.nextLF(raw, p + Constants.OBJECT_ID_STRING_LENGTH);
  }
  return heads;

Hmm, its not that much shorter (~5 lines?).  But the behavior matches C git better.  IIRC C git reads the first 40 characters from the line and ignores the rest of it.  Which is exactly what are doing above by using nextLF.