private void Add(int tree, int stage)
            {
                AbstractTreeIterator i = GetTree(tree);

                if (i == null)
                {
                    return;
                }

                if (FileMode.Tree.Equals(_tw.getRawMode(tree)))
                {
                    _builder.addTree(_tw.getRawPath(), stage, Repository, _tw.getObjectId(tree));
                }
                else
                {
                    var e = new DirCacheEntry(_tw.getRawPath(), stage);
                    e.setObjectIdFromRaw(i.idBuffer(), i.idOffset());
                    e.setFileMode(_tw.getFileMode(tree));
                    _builder.add(e);
                }
            }