Package org.eclipse.jgit.api

Examples of org.eclipse.jgit.api.InitCommand


      // init git repo
      FileResource<?> gitDir = project.getProjectRoot().getChildDirectory(".git").reify(FileResource.class);
      if(!gitDir.exists())
      {
         InitCommand init = Git.init();
         init.setDirectory(project.getProjectRoot().getUnderlyingResourceObject());
         init.call();
      }

      return true;
   }
View Full Code Here


      log("Initializing bare repository at " + destination);
    } else {
      log("Initializing repository at " + destination);
    }
    try {
      InitCommand init = Git.init();
      init.setBare(bare).setDirectory(destination);
      init.call();
    } catch (Exception e) {
      throw new BuildException("Could not initialize repository", e);
    }
  }
View Full Code Here

   {
      // init git repo
      FileResource<?> gitDir = project.getProjectRoot().getChildDirectory(".git").reify(FileResource.class);
      if (!gitDir.exists())
      {
         InitCommand init = Git.init();
         init.setDirectory(project.getProjectRoot().getUnderlyingResourceObject());

         try
         {
            init.call();
         }
         catch (GitAPIException e)
         {
         }
      }
View Full Code Here

    return false;
  }

  @Override
  protected void run() throws Exception {
    InitCommand command = Git.init();
    command.setBare(bare);
    if (gitdir != null)
      command.setDirectory(new File(gitdir));
    Repository repository = command.call().getRepository();
    outw.println(MessageFormat.format(
        CLIText.get().initializedEmptyGitRepositoryIn, repository
            .getDirectory().getAbsolutePath()));
  }
View Full Code Here

    return dir.delete();
  }

  @Test
  public void testGetGitDirWorkspaceIsInRepo() throws Exception {
    InitCommand command = new InitCommand();
    File workspace = getWorkspaceRoot();
    File parent = workspace.getParentFile();
    command.setDirectory(parent);
    Repository repository = command.call().getRepository();
    assertNotNull(repository);

    createWorkspace(SimpleMetaStore.DEFAULT_WORKSPACE_NAME);
    JSONObject project = createProjectOrLink(workspaceLocation, getMethodName().concat("Project"), null);
    String location = project.getString(ProtocolConstants.KEY_CONTENT_LOCATION);
View Full Code Here

  @Override
  public IStatus performJob() {
    Repository repository = null;
    try {
      InitCommand command = new InitCommand();
      File directory = new File(clone.getContentLocation());
      command.setDirectory(directory);
      repository = command.call().getRepository();
      Git git = new Git(repository);

      // configure the repo
      GitCloneHandlerV1.doConfigureClone(git, user, gitUserName, gitUserMail);
View Full Code Here

      // init git repo
      final DirectoryResource rootDirectory = project.getRootDirectory();
      FileResource<?> gitDir = rootDirectory.getChildDirectory(GIT_DIRECTORY).reify(FileResource.class);
      if (!gitDir.exists())
      {
         InitCommand init = Git.init();
         init.setDirectory(rootDirectory.getUnderlyingResourceObject());

         try
         {
            gitUtils.close(init.call());
         }
         catch (GitAPIException e)
         {
         }
      }
View Full Code Here

      // init git repo
      final DirectoryResource rootDirectory = project.getRootDirectory();
      FileResource<?> gitDir = rootDirectory.getChildDirectory(".git").reify(FileResource.class);
      if (!gitDir.exists())
      {
         InitCommand init = Git.init();
         init.setDirectory(rootDirectory.getUnderlyingResourceObject());

         try
         {
            gitUtils.close(init.call());
         }
         catch (GitAPIException e)
         {
         }
      }
View Full Code Here

          throw new IOException("gitdir '" + gitdir + "' is not a directory");
        if (!(new File(gitdir, ".git").exists()))
        {
          logger.info("Creating Git repository at " + gitdir);
          gitdir.mkdirs();
          InitCommand initCommand = Git.init();
          initCommand.setDirectory(gitdir);
          initCommand.call();
        }
      } catch (IOException ex)
      {
        logger.severe("Invalid git directory: " + ex.getMessage());
        return;
View Full Code Here

   {
      // init git repo
      FileResource<?> gitDir = project.getProjectRoot().getChildDirectory(".git").reify(FileResource.class);
      if (!gitDir.exists())
      {
         InitCommand init = Git.init();
         init.setDirectory(project.getProjectRoot().getUnderlyingResourceObject());

         try
         {
            GitUtils.close(init.call());
         }
         catch (GitAPIException e)
         {
         }
      }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.api.InitCommand

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.