Source:
protected void runInternal(GeogigCLI cli) throws InvalidParameterException, CommandFailedException, IOException { GeoGIG geogig = cli.getGeogig(); IndexDatabase indexDatabase = geogig.getRepository().indexDatabase(); if (indexDatabase.getIndex(tree, attribute).isPresent()) { throw new CommandFailedException( "An index has already been created on that tree and attribute."); } Optional<RevFeatureType> featureTypeOpt = geogig.command(ResolveFeatureType.class) .setRefSpec("HEAD:" + tree).call(); if (!featureTypeOpt.isPresent()) { throw new CommandFailedException( String.format("Can't resolve '%s' as a feature type", tree)); } RevFeatureType treeType = featureTypeOpt.get(); boolean attributeFound = false; PropertyType attributeType = null; for (PropertyDescriptor descriptor : treeType.descriptors()) { if (descriptor.getName().toString().equals(attribute)) { attributeFound = true; attributeType = descriptor.getType(); } } if (!attributeFound) { throw new CommandFailedException(String.format( "Could not find an attribute named '%s' in the feature type.", attribute)); } if (!(attributeType instanceof GeometryType)) { throw new UnsupportedOperationException( "Only indexes on spatial attributes are currently supported."); } Index index = indexDatabase.createIndex(tree, attribute, IndexType.QUADTREE); if (indexHistory) { ImmutableList<Ref> branches = geogig.command(BranchListOp.class).setLocal(true) .setRemotes(true) .call(); for (Ref ref : branches) { Iterator<RevCommit> commits = geogig.command(LogOp.class) .setUntil(ref.getObjectId()).call(); while (commits.hasNext()) { RevCommit next = commits.next(); createQuadTree(cli, next.getId().toString(), index); } } } else { createQuadTree(cli, "HEAD", index); } }

Target:
protected void runInternal(GeogigCLI cli) throws InvalidParameterException, CommandFailedException, IOException { GeoGIG geogig = cli.getGeogig(); IndexDatabase indexDatabase = geogig.getRepository().indexDatabase(); if (indexDatabase.getIndex(tree, attribute).isPresent()) { throw new CommandFailedException( "An index has already been created on that tree and attribute."); } Optional<RevFeatureType> featureTypeOpt = geogig.command(ResolveFeatureType.class) .setRefSpec("HEAD:" + tree).call(); if (!featureTypeOpt.isPresent()) { throw new CommandFailedException( String.format("Can't resolve '%s' as a feature type", tree)); } RevFeatureType treeType = featureTypeOpt.get(); boolean attributeFound = false; PropertyType attributeType = null; for (PropertyDescriptor descriptor : treeType.descriptors()) { if (descriptor.getName().toString().equals(attribute)) { attributeFound = true; attributeType = descriptor.getType(); break; } } if (!attributeFound) { throw new CommandFailedException(String.format( "Could not find an attribute named '%s' in the feature type.", attribute)); } if (!(attributeType instanceof GeometryType)) { throw new UnsupportedOperationException( "Only indexes on spatial attributes are currently supported."); } Index index = indexDatabase.createIndex(tree, attribute, IndexType.QUADTREE, null ); if (indexHistory) { ImmutableList<Ref> branches = geogig.command(BranchListOp.class).setLocal(true) .setRemotes(true) .call(); for (Ref ref : branches) { Iterator<RevCommit> commits = geogig.command(LogOp.class) .setUntil(ref.getObjectId()).call(); while (commits.hasNext()) { RevCommit next = commits.next(); createQuadTree(cli, next.getId().toString(), index); } } } else { createQuadTree(cli, "HEAD", index); } }