public void runInternal(GeogigCLI cli) {
final GeoGIG geogig = cli.getGeogig();
ResetMode mode = resolveResetMode();
ResetOp reset = cli.getGeogig().command(ResetOp.class);
try {
for (int i = 0; args != null && i < args.size(); i++) {
reset.addPattern(args.get(i));
}
if (commit != null && commit.size() > 0) {
Optional<ObjectId> commitId = geogig.command(RevParse.class)
.setRefSpec(commit.get(0)).call();
checkParameter(commitId.isPresent(), "Commit could not be resolved.");
reset.setCommit(Suppliers.ofInstance(commitId.get()));
}
reset.setMode(mode);
reset.call();
} catch (IllegalArgumentException iae) {
throw new CommandFailedException(iae.getMessage(), iae);
} catch (IllegalStateException ise) {
throw new CommandFailedException(ise.getMessage(), ise);
}