private RevTree resolveTree(@Nullable final String treeIsh, @Nullable final ObjectId treeOid, @Nullable RevTree tree, final ObjectStore source) { ResolveTreeish command = null; if (tree != null) { return tree; } if (treeOid != null) { if (ObjectId.NULL.equals(treeOid) || RevTree.EMPTY_TREE_ID.equals(treeOid)) { tree = RevTree.EMPTY; } else { command = command(ResolveTreeish.class).setSource(source).setTreeish(treeOid); } } else if (treeIsh.equals(ObjectId.NULL.toString()) || RevTree.EMPTY_TREE_ID.toString().equals(treeIsh)) { tree = RevTree.EMPTY; } else { command = command(ResolveTreeish.class).setSource(source).setTreeish(treeIsh); } if (tree == null) { final Optional<ObjectId> treeId = command.call(); checkArgument(treeId.isPresent(), treeIsh + " did not resolve to a tree"); tree = source.getTree(treeId.get()); } return tree; }
private RevTree resolveTree(@Nullable final String treeIsh, @Nullable final ObjectId treeOid, final ObjectStore source) { RevTree tree = null; ResolveTreeish command = null; if (treeOid != null) { if (ObjectId.NULL.equals(treeOid) || RevTree.EMPTY_TREE_ID.equals(treeOid)) { tree = RevTree.EMPTY; } else { command = command(ResolveTreeish.class).setSource(source).setTreeish(treeOid); } } else if (treeIsh.equals(ObjectId.NULL.toString()) || RevTree.EMPTY_TREE_ID.toString().equals(treeIsh)) { tree = RevTree.EMPTY; } else { command = command(ResolveTreeish.class).setSource(source).setTreeish(treeIsh); } if (tree == null) { final Optional<ObjectId> treeId = command.call(); checkArgument(treeId.isPresent(), treeIsh + " did not resolve to a tree"); tree = source.getTree(treeId.get()); } return tree; }