use of org.locationtech.geogig.api.porcelain.FetchOp in project GeoGig by boundlessgeo.
the class FetchOpTest method testFetchNewCommitsWithShallowClone.
@Test
public void testFetchNewCommitsWithShallowClone() throws Exception {
prepareForFetch(false);
// clone the repository
CloneOp clone = clone();
clone.setDepth(2);
clone.setRepositoryURL(remoteGeogig.envHome.getCanonicalPath()).call();
// Checkout master and commit some changes
remoteGeogig.geogig.command(CheckoutOp.class).setSource("master").call();
insertAndAdd(remoteGeogig.geogig, points1_modified);
RevCommit commit = remoteGeogig.geogig.command(CommitOp.class).call();
expectedMaster.addFirst(commit);
FetchOp fetch = fetch();
fetch.call();
// Make sure the local repository got all of the commits from master
localGeogig.geogig.command(CheckoutOp.class).setSource("refs/remotes/origin/master").call();
Iterator<RevCommit> logs = localGeogig.geogig.command(LogOp.class).call();
List<RevCommit> logged = Lists.newArrayList(logs);
assertEquals(3, logged.size());
assertEquals(expectedMaster.get(0), logged.get(0));
assertEquals(expectedMaster.get(1), logged.get(1));
assertEquals(expectedMaster.get(2), logged.get(2));
}
Aggregations