  private Modifications createModifications(TreeWalk treeWalk, RevCommit commit)
    throws IOException
  {
    Modifications modifications = null;
    treeWalk.reset();
    treeWalk.setRecursive(true);
    if (commit.getParentCount() > 0)
    {
      RevCommit parent = commit.getParent(0);
      RevTree tree = parent.getTree();
      if ((tree == null) && (revWalk != null))
      {
        revWalk.parseHeaders(parent);
        tree = parent.getTree();
      }
      if (tree != null)
      {
        treeWalk.addTree(tree);
      }
      else
      {
        if (logger.isTraceEnabled())
        {
          logger.trace("no parent tree at position 0 for commit {}", commit);
        }
        treeWalk.addTree(new EmptyTreeIterator());
      }
    }
    else
    {
      if (logger.isTraceEnabled())
      {
        logger.trace("no parent available for commit {}", commit);
      }
      treeWalk.addTree(new EmptyTreeIterator());
    }
    treeWalk.addTree(commit.getTree());
    List<DiffEntry> entries = DiffEntry.scan(treeWalk);
    for (DiffEntry e : entries)
    {
      if (!e.getOldId().equals(e.getNewId()))
      {
        if (modifications == null)
        {
          modifications = new Modifications();
        }
        appendModification(modifications, e);
      }
    }
    return modifications;
  }

  private Modifications createModifications(TreeWalk treeWalk, RevCommit commit)
    throws IOException
  {
    Modifications modifications = null;
    treeWalk.reset();
    treeWalk.setRecursive(true);
    if (commit.getParentCount() > 0)
    {
      RevCommit parent = commit.getParent(0);
      RevTree tree = parent.getTree();
      if ((tree == null) && (revWalk != null))
      {
        revWalk.parseHeaders(parent);
        tree = parent.getTree();
      }
      if (tree != null)
      {
        treeWalk.addTree(tree);
      }
      else
      {
        if (logger.isTraceEnabled())
        {
          logger.trace("no parent tree at position 0 for commit {}",
            commit.getName());
        }
        treeWalk.addTree(new EmptyTreeIterator());
      }
    }
    else
    {
      if (logger.isTraceEnabled())
      {
        logger.trace("no parent available for commit {}", commit.getName());
      }
      treeWalk.addTree(new EmptyTreeIterator());
    }
    treeWalk.addTree(commit.getTree());
    List<DiffEntry> entries = DiffEntry.scan(treeWalk);
    for (DiffEntry e : entries)
    {
      if (!e.getOldId().equals(e.getNewId()))
      {
        if (modifications == null)
        {
          modifications = new Modifications();
        }
        appendModification(modifications, e);
      }
    }
    return modifications;
  }
