Package org.eclipse.jgit.storage.file

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


    result.name = name;

    File folder = new File(repositoriesFolder, name);
    if (folder.exists()) {
      File gitDir = FileKey.resolve(new File(repositoriesFolder, name), FS.DETECTED);
      Repository repository = new FileRepositoryBuilder().setGitDir(gitDir).build();
      result.fetchResult = fetchRepository(credentialsProvider, repository);
      repository.close();
    } else {
      CloneCommand clone = new CloneCommand();
      clone.setBare(bare);
View Full Code Here


  }

  private static Repository getRepository(String name) {
    try {
      File gitDir = FileKey.resolve(new File(REPOSITORIES, name), FS.DETECTED);
      Repository repository = new FileRepositoryBuilder().setGitDir(gitDir).build();
      return repository;
    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
View Full Code Here

  @Test
  public void testPushLog() throws IOException {
    String name = "refchecks/ticgit.git";
    File refChecks = new File(GitBlitSuite.REPOSITORIES, name);
    Repository repository = new FileRepositoryBuilder().setGitDir(refChecks).build();
    List<RefLogEntry> pushes = RefLogUtils.getRefLog(name, repository);
    GitBlitSuite.close(repository);
    assertTrue("Repository has an empty push log!", pushes.size() > 0);
  }
View Full Code Here

  @Test
  public void testPushLog() throws IOException {
    String name = "~james/helloworld.git";
    File gitDir = FileKey.resolve(new File(GitBlitSuite.REPOSITORIES, name), FS.DETECTED);
    Repository repository = new FileRepositoryBuilder().setGitDir(gitDir).build();
    List<RefLogEntry> pushes = RefLogUtils.getRefLog(name, repository);
    GitBlitSuite.close(repository);
  }
View Full Code Here


      try {
        // load repository config
        File gitDir = FileKey.resolve(new File(folder, repo), FS.DETECTED);
        Repository repository = new FileRepositoryBuilder().setGitDir(gitDir).build();
        StoredConfig config = repository.getConfig();
        config.load();

        Set<String> indexedBranches = new LinkedHashSet<String>();
View Full Code Here

  @Override
  public void execute() throws BuildException {
    CheckoutCommand checkout;
    try {
      Repository repo = new FileRepositoryBuilder().readEnvironment()
          .findGitDir(src).build();
      checkout = new Git(repo).checkout();
    } catch (IOException e) {
      throw new BuildException("Could not access repository " + src, e);
    }
View Full Code Here

          + ") is not a git repository.");
    }

    AddCommand gitAdd;
    try {
      Repository repo = new FileRepositoryBuilder().readEnvironment()
          .findGitDir(src).build();
      gitAdd = new Git(repo).add();
    } catch (IOException e) {
      throw new BuildException("Could not access repository " + src, e);
    }
View Full Code Here

   *             the repository appears to already exist but cannot be
   *             accessed.
   * @see FileRepositoryBuilder
   */
  public FileRepository(final File gitDir) throws IOException {
    this(new FileRepositoryBuilder().setGitDir(gitDir).setup());
  }
View Full Code Here

  public void testShouldAutomagicallyDetectGitDirectory() throws Exception {
    Repository r = createWorkRepository();
    File d = new File(r.getDirectory(), "sub-dir");
    FileUtils.mkdir(d);

    assertEquals(r.getDirectory(), new FileRepositoryBuilder()
        .findGitDir(d).getGitDir());
  }
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.setMustExist(true);
    Repository repo2 = builder.build();

    assertEquals(repo1.getDirectory().getAbsolutePath(), repo2
        .getDirectory().getAbsolutePath());
    assertEquals(dir, repo2.getWorkTree());
  }
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.