public static void main(final String[] args) throws Exception {

    logger.debug("init");

    final FileRepositoryBuilder builder = new FileRepositoryBuilder();
    builder.setGitDir(FILE);
    builder.readEnvironment();
    builder.findGitDir();

    final Repository repo = builder.build();

    // logger.debug("branch=" + repo.getBranch());
    // logger.debug("state=" + repo.getRepositoryState());

    switch (repo.getRepositoryState()) {
      case BARE:
        break;
      case SAFE:
        break;
      default:
        logger.error("wrong state");
    }

    final Git git = make();
    logger.debug("state=" + git.getRepository().getRepositoryState());

    // git.checkout().setName(Constants.MASTER).call();
    // git.pull().setTimeout(10).call();

    git.fetch().call();

    git.checkout().setName("current-config").call();

    // runClone();

    // final Git git = Git.open(FILE);
    // final StatusCommand status = git.status();
    // final Status result = status.call();
    // logger.debug("result=" + result);

    // final Git git = new Git(repo);

    // final RevCommit commit =
    // git.commit().setMessage("test commit").call();

    // final RevTag tag = git.tag().setName("test_tag").call();

    // logger.debug("branch=" + repo.getBranch());
    // logger.debug("state=" + repo.getRepositoryState());

    logger.debug("done");
  }
  public ZeusManager(File root) throws IOException {

    if (root.canRead() && root.isDirectory()) {
      this.root = root;
      this.baseServiceUrl = SVC_BASE_URL;

      // get the repository name.
      FileRepositoryBuilder repobuiler = new FileRepositoryBuilder();
      this.sourceRepository = repobuiler.findGitDir(root).build();

      ghClient = new GitHubClient();
    } else {
      // TODO: throw exception
    }
  }
  @SuppressWarnings("resource" /* java 7 */)
  @Test
  public void scanWithGitDirRef() throws Exception {
    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(), builder.getGitDir());
    builder.setMustExist(true);
    Repository repo2 = builder.build();

    assertEquals(repo1.getDirectory(), repo2.getDirectory());
    assertEquals(dir, repo2.getWorkTree());
  }