class CloneGit extends AbstractCommand {

  @Override
  public void execute() throws Exception {
    final String packageName = getArgument(0);
    final String branch = getOptionalArgument(1).orElse("master");
    logger.debug("Package name: {}, Branch: {}", packageName, branch);

    final String remoteUri = MessageFormat.format(URI_PATTERN, packageName);
    final InMemoryRepository repository = new InMemoryRepository(new DfsRepositoryDescription());
    final Git git = new Git(repository);
    git.remoteAdd().setName("origin").setUri(new URIish(remoteUri)).call();

    logger.trace("Git: {}", git);

    final FetchResult fetchResult = git.fetch()
        .setRemote("origin")
        .setRefSpecs("+refs/heads/" + branch + ":refs/remotes/origin/" + branch)
        .call();
    logger.debug("Fetch result: {}", fetchResult);

    logger.debug("Refs: {}", fetchResult.getAdvertisedRefs());
    final Ref fetchHead = fetchResult.getAdvertisedRef(HEAD);

    final ObjectId commitId = fetchHead.getObjectId();
    logger.debug("Commit id: {}", commitId);

    try (final RevWalk revWalk = new RevWalk(repository)) {
      visit(repository, revWalk, commitId);
    }
    logger.debug("FileSet: {}", fileSet);
  }

}