Example usage for org.eclipse.jgit.transport RemoteConfig setMirror

List of usage examples for org.eclipse.jgit.transport RemoteConfig setMirror

Introduction

In this page you can find the example usage for org.eclipse.jgit.transport RemoteConfig setMirror.

Prototype

public void setMirror(boolean m) 

Source Link

Document

Set the mirror flag to automatically delete remote refs.

Usage

From source file:com.netbeetle.reboot.git.CachedRepository.java

License:Apache License

public void init() throws IOException, URISyntaxException {
    if (exists()) {
        return;//from   w  w w .  j av  a 2 s  .  c  o m
    }

    repository.create(true);
    StoredConfig config = repository.getConfig();
    RemoteConfig remoteConfig = new RemoteConfig(config, "origin");
    remoteConfig.addURI(new URIish(uri));
    remoteConfig.setMirror(true);
    remoteConfig.addFetchRefSpec(new RefSpec().setForceUpdate(true).setSourceDestination("refs/*", "refs/*"));
    remoteConfig.update(config);
    config.save();
}