Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.Repository.create()


    File indexFile = new File(trash, "idx");
    File objDir = new File(trash, "../obj");
    File altObjDir = db.getObjectDatabase().getDirectory();
    Repository repo1initial = new FileRepository(new File(repo1Parent,
        Constants.DOT_GIT));
    repo1initial.create();
    repo1initial.close();

    File theDir = new File(repo1Parent, Constants.DOT_GIT);
    FileRepository r = (FileRepository) new FileRepositoryBuilder() //
        .setGitDir(theDir).setObjectDirectory(objDir) //
View Full Code Here


      randomLocation = randomLocation.addTrailingSeparator().append(Constants.DOT_GIT);
      File dotGitDir = randomLocation.toFile().getCanonicalFile();
      Repository db2 = FileRepositoryBuilder.create(dotGitDir);
      toClose.add(db2);
      assertFalse(dotGitDir.exists());
      db2.create(false /* non bare */);

      Git git2 = new Git(db2);
      // dummy commit to start off new branch
      File branchFile = new File(dotGitDir.getParentFile(), "branch.txt");
      branchFile.createNewFile();
View Full Code Here

      IPath randomLocation = createTempDir();
      randomLocation = randomLocation.addTrailingSeparator().append(Constants.DOT_GIT);
      File dotGitDir = randomLocation.toFile().getCanonicalFile();
      Repository db2 = FileRepositoryBuilder.create(dotGitDir);
      assertFalse(dotGitDir.exists());
      db2.create(false /* non bare */);
      toClose.add(db2);

      // dummy commit to start off master branch
      File dummyFile = new File(dotGitDir.getParentFile(), "test.txt");
      dummyFile.createNewFile();
View Full Code Here

      if (gitDir == null) {
        gitDir = new File(localFile, Constants.DOT_GIT);
        Repository repo = null;
        try {
          repo = FileRepositoryBuilder.create(gitDir);
          repo.create();
          // we need to perform an initial commit to workaround JGit bug 339610.
          Git git = new Git(repo);
          git.add().addFilepattern(".").call(); //$NON-NLS-1$
          git.commit().setMessage("Initial commit").call();
        } finally {
View Full Code Here

            final String repositoryPath = pathResolver.getFocusedIdentifier(
                    Path.ROOT, Constants.DOT_GIT);
            final Repository repository = new FileRepositoryBuilder()
                    .readEnvironment().setGitDir(new File(repositoryPath))
                    .build();
            repository.create();
        }
        catch (final Exception e) {
            throw new IllegalStateException(
                    "Could not initialize Git repository", e);
        }
View Full Code Here

   * @throws IOException
   */
  public void test000_openrepo_default_gitDirSet() throws IOException {
    File repo1Parent = new File(trash.getParentFile(), "r1");
    Repository repo1initial = new FileRepository(new File(repo1Parent, Constants.DOT_GIT));
    repo1initial.create();
    repo1initial.close();

    File theDir = new File(repo1Parent, Constants.DOT_GIT);
    FileRepository r = new FileRepositoryBuilder().setGitDir(theDir).build();
    assertEqualsPath(theDir, r.getDirectory());
View Full Code Here

   * @throws IOException
   */
  public void test000_openrepo_default_gitDirAndWorkTreeSet() throws IOException {
    File repo1Parent = new File(trash.getParentFile(), "r1");
    Repository repo1initial = new FileRepository(new File(repo1Parent, Constants.DOT_GIT));
    repo1initial.create();
    repo1initial.close();

    File theDir = new File(repo1Parent, Constants.DOT_GIT);
    FileRepository r = new FileRepositoryBuilder().setGitDir(theDir)
        .setWorkTree(repo1Parent.getParentFile()).build();
View Full Code Here

   * @throws IOException
   */
  public void test000_openrepo_default_workDirSet() throws IOException {
    File repo1Parent = new File(trash.getParentFile(), "r1");
    Repository repo1initial = new FileRepository(new File(repo1Parent, Constants.DOT_GIT));
    repo1initial.create();
    repo1initial.close();

    File theDir = new File(repo1Parent, Constants.DOT_GIT);
    FileRepository r = new FileRepositoryBuilder().setWorkTree(repo1Parent).build();
    assertEqualsPath(theDir, r.getDirectory());
View Full Code Here

    File repo1Parent = new File(trash.getParentFile(), "r1");
    File indexFile = new File(trash, "idx");
    File objDir = new File(trash, "../obj");
    File altObjDir = db.getObjectDatabase().getDirectory();
    Repository repo1initial = new FileRepository(new File(repo1Parent, Constants.DOT_GIT));
    repo1initial.create();
    repo1initial.close();

    File theDir = new File(repo1Parent, Constants.DOT_GIT);
    FileRepository r = new FileRepositoryBuilder() //
        .setGitDir(theDir).setObjectDirectory(objDir) //
View Full Code Here

                = GitRepository.getRepoForMergingPrefix() + project.owner + "/" + project.name +
                ".git";
        File repoDir = new File(
                GitRepository.getDirectoryForMerging(project.owner, project.name) + "/.git");
        Repository repo = new RepositoryBuilder().setGitDir(repoDir).build();
        repo.create(false);

        // when
        baseCommit = support.Git.commit(repo, wcPath, "a.txt", "read me", "base commit");
        firstCommit = support.Git.commit(repo, wcPath, "a.txt", "hello", "commit 1");
        secondCommit = support.Git.commit(repo, wcPath, "b.txt", "world", "commit 2");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.