private static TestProject project(final String name) { try { final File originDir = copyTestProjectToTemporaryLocation(name); performPomSubstitution(originDir); final InitCommand initCommand = Git.init(); initCommand.setDirectory(originDir); final Git origin = initCommand.call(); origin.add().addFilepattern(".").call(); origin.commit().setMessage("Initial commit").call(); final File localDir = Photocopier.folderForSampleProject(name); final Git local = Git.cloneRepository().setBare(false).setDirectory(localDir) .setURI(originDir.toURI().toString()).call(); return new TestProject(originDir, origin, localDir, local); } catch (final Exception e) { throw new RuntimeException("Error while creating copies of the test project", e); } }
private static TestProject project(String name) { try { File originDir = copyTestProjectToTemporaryLocation(name); performPomSubstitution(originDir); InitCommand initCommand = Git.init(); initCommand.setDirectory(originDir); Git origin = initCommand.call(); origin.add().addFilepattern(".").call(); origin.commit().setMessage("Initial commit").call(); File localDir = Photocopier.folderForSampleProject(name); Git local = Git.cloneRepository() .setBare(false) .setDirectory(localDir) .setURI(originDir.toURI().toString()) .call(); return new TestProject(originDir, origin, localDir, local); } catch (Exception e) { throw new RuntimeException("Error while creating copies of the test project", e); } }
public AccumuloConfigurations(Configuration config) throws Exception { Preconditions.checkNotNull(config, "Configuration must be supplied"); gitDir = new File(config.getDataDir()+"/git"); LOG.debug("Creating Git repository at {}", gitDir); if (!gitDir.exists()) { if (!gitDir.mkdir()) { throw new IOException("Error creating directory: "+gitDir.getAbsolutePath()); } InitCommand initCommand = Git.init(); initCommand.setBare(false); initCommand.setDirectory(gitDir); git = initCommand.call(); CommitCommand commit = git.commit(); commit.setMessage("Initial commit").call(); repo = git.getRepository(); } else { git = Git.open(gitDir); repo = git.getRepository(); } LOG.info("Accumulo configuration store initialized"); }
public static void importNewGitProject(UserDetails userDetails, File basedir, String message, String gitUrl, String branch, String origin, Logger logger) throws GitAPIException { GitUtils.disableSslCertificateChecks(); InitCommand initCommand = Git.init(); initCommand.setDirectory(basedir); Git git = initCommand.call(); logger.info("Initialised an empty git configuration repo at {}", basedir.getAbsolutePath()); gitAddCommitAndPush(git, gitUrl, userDetails, basedir, message, branch, origin, logger); }
public boolean initialiseGitRepository() throws GitAPIException { FileUtil.createDir(VersionsControllerFixture.TEST_DIR); new InitCommand() .setDirectory(new File(VersionsControllerFixture.TEST_DIR)) .setBare(false) .call(); return true; }
public void initialiseGitRepo() throws Exception { //FileRepository archiFileRepo = new FileRepository(gitDir); InitCommand repoInit = Git.init(); repoInit.setDirectory(gitDir); //repoInit.setBare(true); archiRepo = repoInit.call(); }
private static Git emptyRepo() throws GitAPIException { File dir = Photocopier.folderForSampleProject("blah"); InitCommand initCommand = Git.init(); initCommand.setDirectory(dir); return initCommand.call(); }