private TreeDifference computeTreeDifference() { final String rightTreeish = Ref.STAGE_HEAD; final ObjectId rootTreeId = resolveRootTreeId(); final ObjectId stageRootId = stagingArea().getTree().getId(); final Supplier<Iterator<NodeRef>> leftTreeRefs; final Supplier<Iterator<NodeRef>> rightTreeRefs; if (rootTreeId.isNull()) { Iterator<NodeRef> empty = Collections.emptyIterator(); leftTreeRefs = Suppliers.ofInstance(empty); } else { leftTreeRefs = command(LsTreeOp.class).setReference(rootTreeId.toString()) .setStrategy(Strategy.DEPTHFIRST_ONLY_TREES); } rightTreeRefs = command(LsTreeOp.class).setReference(rightTreeish) .setStrategy(Strategy.DEPTHFIRST_ONLY_TREES); MutableTree leftTree = MutableTree.createFromRefs(rootTreeId, leftTreeRefs); MutableTree rightTree = MutableTree.createFromRefs(stageRootId, rightTreeRefs); TreeDifference treeDifference = TreeDifference.create(leftTree, rightTree); return treeDifference; }
private TreeDifference computeTreeDifference() { final String rightTreeish = Ref.STAGE_HEAD; final ObjectId rootTreeId = resolveRootTreeId(); final ObjectId stageRootId = stagingArea().getTree().getId(); final Supplier<Iterator<NodeRef>> leftTreeRefs; final Supplier<Iterator<NodeRef>> rightTreeRefs; if (rootTreeId.isNull()) { Iterator<NodeRef> empty = Collections.emptyIterator(); leftTreeRefs = Suppliers.ofInstance(empty); } else { leftTreeRefs = command(LsTreeOp.class).setReference(rootTreeId.toString()) .setStrategy(Strategy.DEPTHFIRST_ONLY_TREES); } rightTreeRefs = command(LsTreeOp.class).setReference(rightTreeish) .setStrategy(Strategy.DEPTHFIRST_ONLY_TREES); MutableTree leftTree = MutableTree.createFromRefs(rootTreeId, leftTreeRefs); MutableTree rightTree = MutableTree.createFromRefs(stageRootId, rightTreeRefs); TreeDifference treeDifference = TreeDifference.create(leftTree, rightTree); return treeDifference; }
final ObjectId stageRootId = stagingArea().getTree().getId(); return stageRootId;
final ObjectId stageRootId = stagingArea().getTree().getId(); return stageRootId;