private void addTrees(Map<SubtreeConfig, RevCommit> parentCommits, TreeWalk treeWalk)
     throws IOException {
   for (Map.Entry<SubtreeConfig, RevCommit> entry : parentCommits.entrySet()) {
     String directory = entry.getKey().getSubtreeDirectory();
     RevCommit parentCommit = entry.getValue();
     if (".".equals(directory)) {
       treeWalk.addTree(parentCommit.getTree());
     } else {
       byte[] prefix = directory.getBytes(RawParseUtils.UTF8_CHARSET);
       CanonicalTreeParser treeParser =
           new CanonicalTreeParser(prefix, treeWalk.getObjectReader(), parentCommit.getTree());
       treeWalk.addTree(treeParser);
     }
   }
 }
 /**
  * Returns a path model of the current file in the treewalk.
  *
  * @param tw
  * @param basePath
  * @param commit
  * @return a path model of the current file in the treewalk
  */
 private static PathModel getPathModel(TreeWalk tw, String basePath, RevCommit commit) {
   String name;
   long size = 0;
   if (basePath == null) {
     name = tw.getPathString();
   } else {
     name = tw.getPathString().substring(basePath.length() + 1);
   }
   try {
     if (!tw.isSubtree()) {
       size = tw.getObjectReader().getObjectSize(tw.getObjectId(0), Constants.OBJ_BLOB);
     }
   } catch (Throwable t) {
     // error(t, null, "failed to retrieve blob size for " + tw.getPathString());
     Logger.error(t, t.getMessage());
   }
   return new PathModel(
       name, tw.getPathString(), size, tw.getFileMode(0).getBits(), commit.getName());
 }