void (@NotNull List<R> records, @NotNull Map<String, String> hashToTreeMap) { R firstRecord = records.get(0); String commit = firstRecord.getHash(); String[] parents = firstRecord.getParentsHashes(); String commitTreeHash = hashToTreeMap.get(commit); LOG.assertTrue(commitTreeHash != null, "Could not get tree hash for commit " + commit); for (int parentIndex = 0; parentIndex < parents.length; parentIndex++) { String parent = parents[parentIndex]; // sometimes a merge commit is identical to all its parents // in this case, we get one empty record String parentTreeHash = hashToTreeMap.get(parent); LOG.assertTrue(parentTreeHash != null, "Could not get tree hash for commit " + parent); if (parentTreeHash.equals(commitTreeHash) && records.size() < parents.length) { records.add(parentIndex, createEmptyCopy(firstRecord)); } } }