Package org.eclipse.jgit.storage.file

Examples of org.eclipse.jgit.storage.file.FileRepositoryBuilder


    assertTrue(dir.mkdir());
    File dotGit = new File(dir, Constants.DOT_GIT);
    new FileWriter(dotGit).append("gitdir: ../" + Constants.DOT_GIT)
        .close();

    FileRepositoryBuilder builder = new FileRepositoryBuilder();
    builder.setWorkTree(dir);
    builder.setMustExist(true);
    Repository repo2 = builder.build();

    // The tmp directory may be a symlink so the actual path
    // may not
    assertEquals(repo1.getDirectory().getCanonicalPath(), repo2
        .getDirectory().getCanonicalPath());
View Full Code Here


    Repository repo1 = createWorkRepository();
    File dir = createTempDirectory("dir");
    File dotGit = new File(dir, Constants.DOT_GIT);
    new FileWriter(dotGit).append(
        "gitdir: " + repo1.getDirectory().getAbsolutePath()).close();
    FileRepositoryBuilder builder = new FileRepositoryBuilder();

    builder.setWorkTree(dir);
    builder.findGitDir(dir);
    assertEquals(repo1.getDirectory().getAbsolutePath(), builder
        .getGitDir().getAbsolutePath());
    builder.setMustExist(true);
    Repository repo2 = builder.build();

    // The tmp directory may be a symlink
    assertEquals(repo1.getDirectory().getCanonicalPath(), repo2
        .getDirectory().getCanonicalPath());
    assertEquals(dir, repo2.getWorkTree());
View Full Code Here

  }

  @Test
  public void testNotBare_CreateRepositoryFromWorkDirOnly() throws Exception {
    File workdir = getFile("workdir", "repo");
    Repository repo = new FileRepositoryBuilder().setWorkTree(workdir)
        .build();
    assertFalse(repo.isBare());
    assertWorkdirPath(repo, "workdir", "repo");
    assertGitdirPath(repo, "workdir", "repo", Constants.DOT_GIT);
  }
View Full Code Here

  @Test
  public void testWorkdirIsDotGit_CreateRepositoryFromWorkDirOnly()
      throws Exception {
    File workdir = getFile("workdir", "repo");
    Repository repo = new FileRepositoryBuilder().setWorkTree(workdir)
        .build();
    assertGitdirPath(repo, "workdir", "repo", Constants.DOT_GIT);
  }
View Full Code Here

  public void testNotBare_CreateRepositoryFromGitDirOnlyWithWorktreeConfig()
      throws Exception {
    File gitDir = getFile("workdir", "repoWithConfig");
    File workTree = getFile("workdir", "treeRoot");
    setWorkTree(gitDir, workTree);
    Repository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
    assertFalse(repo.isBare());
    assertWorkdirPath(repo, "workdir", "treeRoot");
    assertGitdirPath(repo, "workdir", "repoWithConfig");
  }
View Full Code Here

  @Test
  public void testBare_CreateRepositoryFromGitDirOnlyWithBareConfigTrue()
      throws Exception {
    File gitDir = getFile("workdir", "repoWithConfig");
    setBare(gitDir, true);
    Repository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
    assertTrue(repo.isBare());
  }
View Full Code Here

  @Test
  public void testWorkdirIsParent_CreateRepositoryFromGitDirOnlyWithBareConfigFalse()
      throws Exception {
    File gitDir = getFile("workdir", "repoWithBareConfigTrue", "child");
    setBare(gitDir, false);
    Repository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
    assertWorkdirPath(repo, "workdir", "repoWithBareConfigTrue");
  }
View Full Code Here

  @Test
  public void testNotBare_CreateRepositoryFromGitDirOnlyWithBareConfigFalse()
      throws Exception {
    File gitDir = getFile("workdir", "repoWithBareConfigFalse", "child");
    setBare(gitDir, false);
    Repository repo = new FileRepositoryBuilder().setGitDir(gitDir).build();
    assertFalse(repo.isBare());
    assertWorkdirPath(repo, "workdir", "repoWithBareConfigFalse");
    assertGitdirPath(repo, "workdir", "repoWithBareConfigFalse", "child");
  }
View Full Code Here

      }
    }
    if (gitdir == null)
      gitdir = new File(localName, Constants.DOT_GIT).getAbsolutePath();

    dst = new FileRepositoryBuilder().setGitDir(new File(gitdir)).build();
    dst.create();
    final StoredConfig dstcfg = dst.getConfig();
    dstcfg.setBoolean("core", null, "bare", false); //$NON-NLS-1$ //$NON-NLS-2$
    dstcfg.save();
    db = dst;
View Full Code Here

  }

  @Test
  public void test000_openRepoBadArgs() throws IOException {
    try {
      new FileRepositoryBuilder().build();
      fail("Must pass either GIT_DIR or GIT_WORK_TREE");
    } catch (IllegalArgumentException e) {
      assertEquals(JGitText.get().eitherGitDirOrWorkTreeRequired, e
          .getMessage());
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.storage.file.FileRepositoryBuilder

Copyright © 2018 www.massapicom. 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.