List of usage examples for org.eclipse.jgit.lib ConfigConstants CONFIG_KEY_REPO_FORMAT_VERSION
String CONFIG_KEY_REPO_FORMAT_VERSION
To view the source code for org.eclipse.jgit.lib ConfigConstants CONFIG_KEY_REPO_FORMAT_VERSION.
Click Source Link
From source file:jetbrains.buildServer.buildTriggers.vcs.git.GitServerUtil.java
License:Apache License
private static boolean hasValidFormatVersion(Config config) { final String repositoryFormatVersion = config.getString(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION); return "0".equals(repositoryFormatVersion); }
From source file:org.eclipse.egit.ui.view.repositories.GitRepositoriesViewTestBase.java
License:Open Source License
protected static File createProjectAndCommitToRepository() throws Exception { File gitDir = new File(new File(getTestDirectory(), REPO1), Constants.DOT_GIT); gitDir.mkdir();/*from w w w. ja v a2 s .c o m*/ Repository myRepository = lookupRepository(gitDir); myRepository.create(); // TODO Bug: for some reason, this seems to be required myRepository.getConfig().setString(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, "0"); myRepository.getConfig().save(); // we need to commit into master first IProject firstProject = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJ1); if (firstProject.exists()) firstProject.delete(true, null); IProjectDescription desc = ResourcesPlugin.getWorkspace().newProjectDescription(PROJ1); desc.setLocation(new Path(new File(myRepository.getWorkTree(), PROJ1).getPath())); firstProject.create(desc, null); firstProject.open(null); IFolder folder = firstProject.getFolder(FOLDER); folder.create(false, true, null); IFile textFile = folder.getFile(FILE1); textFile.create(new ByteArrayInputStream("Hello, world".getBytes(firstProject.getDefaultCharset())), false, null); IFile textFile2 = folder.getFile(FILE2); textFile2.create(new ByteArrayInputStream("Some more content".getBytes(firstProject.getDefaultCharset())), false, null); new ConnectProviderOperation(firstProject, gitDir).execute(null); IProject secondPoject = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJ2); if (secondPoject.exists()) secondPoject.delete(true, null); desc = ResourcesPlugin.getWorkspace().newProjectDescription(PROJ2); desc.setLocation(new Path(new File(myRepository.getWorkTree(), PROJ2).getPath())); secondPoject.create(desc, null); secondPoject.open(null); IFolder secondfolder = secondPoject.getFolder(FOLDER); secondfolder.create(false, true, null); IFile secondtextFile = secondfolder.getFile(FILE1); secondtextFile.create(new ByteArrayInputStream("Hello, world".getBytes(firstProject.getDefaultCharset())), false, null); IFile secondtextFile2 = secondfolder.getFile(FILE2); secondtextFile2.create( new ByteArrayInputStream("Some more content".getBytes(firstProject.getDefaultCharset())), false, null); new ConnectProviderOperation(secondPoject, gitDir).execute(null); IFile[] commitables = new IFile[] { firstProject.getFile(".project"), textFile, textFile2, secondtextFile, secondtextFile2 }; ArrayList<IFile> untracked = new ArrayList<IFile>(); untracked.addAll(Arrays.asList(commitables)); // commit to stable CommitOperation op = new CommitOperation(commitables, new ArrayList<IFile>(), untracked, "Test Author <test.author@test.com>", "Test Committer <test.commiter@test.com>", "Initial commit"); op.execute(null); // now create a stable branch (from master) createStableBranch(myRepository); // and check in some stuff into master again touchAndSubmit(null); return gitDir; }
From source file:org.eclipse.egit.ui.view.repositories.GitRepositoriesViewTestBase.java
License:Open Source License
protected static File createRemoteRepository(File repositoryDir) throws Exception { Repository myRepository = org.eclipse.egit.core.Activator.getDefault().getRepositoryCache() .lookupRepository(repositoryDir); File gitDir = new File(getTestDirectory(), REPO2); Repository myRemoteRepository = lookupRepository(gitDir); myRemoteRepository.create();//from w ww .j av a 2 s. c o m createStableBranch(myRepository); // now we configure the push destination myRepository.getConfig().setString("remote", "push", "pushurl", "file:///" + myRemoteRepository.getDirectory().getPath()); myRepository.getConfig().setString("remote", "push", "push", "+refs/heads/*:refs/heads/*"); // TODO Bug: for some reason, this seems to be required myRepository.getConfig().setString(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, "0"); myRepository.getConfig().save(); // and push PushConfiguredRemoteAction pa = new PushConfiguredRemoteAction(myRepository, "push"); pa.run(null, false); TestUtil.joinJobs(JobFamilies.PUSH); try { // delete the stable branch again RefUpdate op = myRepository.updateRef("refs/heads/stable"); op.setRefLogMessage("branch deleted", //$NON-NLS-1$ false); // we set the force update in order // to avoid having this rejected // due to minor issues op.setForceUpdate(true); op.delete(); } catch (IOException ioe) { throw new InvocationTargetException(ioe); } return myRemoteRepository.getDirectory(); }