Skip to content

Commit

Permalink
Enable offline testing
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver Kopp <kopp.dev@gmail.com>
  • Loading branch information
koppor committed Jun 21, 2017
1 parent 202622b commit 3aa5d2a
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2012-2013 University of Stuttgart.
* Copyright (c) 2012-2017 University of Stuttgart.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and the Apache License 2.0 which both accompany this distribution,
Expand All @@ -18,11 +18,16 @@
import org.eclipse.winery.repository.backend.filebased.GitBasedRepository;

import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.TransportException;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class PrefsTestEnabledGitBackedRepository extends PrefsTestEnabled {

private static final Logger LOGGER = LoggerFactory.getLogger(PrefsTestEnabledGitBackedRepository.class);

public final Git git;

public PrefsTestEnabledGitBackedRepository() throws Exception {
Expand All @@ -44,7 +49,12 @@ public PrefsTestEnabledGitBackedRepository() throws Exception {
} else {
Repository gitRepo = builder.setWorkTree(repositoryPath.toFile()).setMustExist(false).build();
this.git = new Git(gitRepo);
this.git.fetch().call();
try {
this.git.fetch().call();
} catch (TransportException e) {
// we ignore it to enable offline testing
LOGGER.debug("Working in offline mode", e);
}
}

this.repository = new GitBasedRepository(repositoryPath.toString());
Expand Down

0 comments on commit 3aa5d2a

Please sign in to comment.