Example usage for org.eclipse.jgit.submodule SubmoduleWalk getConfigUrl

List of usage examples for org.eclipse.jgit.submodule SubmoduleWalk getConfigUrl

Introduction

In this page you can find the example usage for org.eclipse.jgit.submodule SubmoduleWalk getConfigUrl.

Prototype

public String getConfigUrl() throws IOException, ConfigInvalidException 

Source Link

Document

Get the configured remote URL for current entry.

Usage

From source file:com.bacoder.scmtools.git.internal.CloneAndProcessCommand.java

License:Apache License

@Override
protected void cloneSubmodules(Repository repository) throws IOException, GitAPIException {
    SubmoduleWalk generator;
    if (isInMemory()) {
        generator = new InMemorySubmoduleWalk(repository, submodulesConfig);
        try {//from   www . j  ava 2s  .  co  m
            DirCache index = repository.readDirCache();
            generator.setTree(new DirCacheIterator(index));
        } catch (IOException e) {
            generator.release();
            throw e;
        }
    } else {
        generator = SubmoduleWalk.forIndex(repository);
    }

    try {
        while (generator.next()) {
            if (generator.getConfigUrl() != null) {
                continue;
            }

            String path = generator.getPath();
            String url = generator.getRemoteUrl();

            CloneAndProcessCommand command = new CloneAndProcessCommand(path, config).setProcessor(processor);
            command.setURI(url).setCloneSubmodules(true);
            command.call();
        }
    } catch (ConfigInvalidException e) {
        throw new IOException("Config invalid", e);
    }
}