Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.StoredConfig.save()


  public void testPullWithMergeConfig2() throws Exception {
    Callable<PullResult> setup = new Callable<PullResult>() {
      public PullResult call() throws Exception {
        StoredConfig config = dbTarget.getConfig();
        config.setString("pull", null, "rebase", "false");
        config.save();
        return target.pull().call();
      }
    };
    doTestPullWithRebase(setup, TestPullMode.MERGE);
  }
View Full Code Here


        .addURI(new URIish(source.getRepository().getWorkTree()
            .getAbsolutePath()));
    config.addFetchRefSpec(new RefSpec(
        "+refs/heads/*:refs/remotes/origin/*"));
    config.update(targetConfig);
    targetConfig.save();

    targetFile = new File(dbTarget.getWorkTree(), "SomeFile.txt");
    // make sure we have the same content
    target.pull().call();
    assertFileContentsEqual(targetFile, "Hello world");
View Full Code Here

    StoredConfig config = localRepository.getConfig();
    RemoteConfig rc = new RemoteConfig(config, "origin");
    rc.addURI(new URIish(remoteRepository.getDirectory().getAbsolutePath()));
    rc.addFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/origin/*"));
    rc.update(config);
    config.save();
    FetchResult res = localGit.fetch().setRemote("origin").call();
    assertFalse(res.getTrackingRefUpdates().isEmpty());
    rup = localRepository.updateRef("refs/heads/master");
    rup.setNewObjectId(initialCommit.getId());
    rup.forceUpdate();
View Full Code Here

  public void emptyRepositoryFormatVersion() throws Exception {
    Repository r = createWorkRepository();
    StoredConfig config = r.getConfig();
    config.setString(ConfigConstants.CONFIG_CORE_SECTION, null,
        ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, "");
    config.save();

    new FileRepository(r.getDirectory());
  }

  @Test
View Full Code Here

  public void invalidRepositoryFormatVersion() throws Exception {
    Repository r = createWorkRepository();
    StoredConfig config = r.getConfig();
    config.setString(ConfigConstants.CONFIG_CORE_SECTION, null,
        ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, "notanumber");
    config.save();

    try {
      new FileRepository(r.getDirectory());
      fail("IllegalArgumentException not thrown");
    } catch (IllegalArgumentException e) {
View Full Code Here

  public void unknownRepositoryFormatVersion() throws Exception {
    Repository r = createWorkRepository();
    StoredConfig config = r.getConfig();
    config.setLong(ConfigConstants.CONFIG_CORE_SECTION, null,
        ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, 1);
    config.save();

    try {
      new FileRepository(r.getDirectory());
      fail("IOException not thrown");
    } catch (IOException e) {
View Full Code Here

  @Test
  public void testExecutableRetention() throws Exception {
    StoredConfig config = db.getConfig();
    config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
        ConfigConstants.CONFIG_KEY_FILEMODE, true);
    config.save();

    FS executableFs = new FS() {

      public boolean supportsExecute() {
        return true;
View Full Code Here

    };

    config = db.getConfig();
    config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
        ConfigConstants.CONFIG_KEY_FILEMODE, false);
    config.save();

    Git git2 = Git.open(db.getDirectory(), nonExecutableFs);
    writeTrashFile(path, "content2");
    git2.add().addFilepattern(path).call();
    RevCommit commit2 = git2.commit().setMessage("commit2").call();
View Full Code Here

    final StoredConfig config = db.getConfig();
    RemoteConfig remoteConfig = new RemoteConfig(config, "test");
    URIish uri = new URIish(remoteRepository.getDirectory().toURI().toURL());
    remoteConfig.addURI(uri);
    remoteConfig.update(config);
    config.save();
  }

  @Test
  public void testFetch() throws JGitInternalException, IOException,
      GitAPIException {
View Full Code Here

    final StoredConfig config = db.getConfig();
    RemoteConfig remoteConfig = new RemoteConfig(config, "test");
    URIish uri = new URIish(db2.getDirectory().toURI().toURL());
    remoteConfig.addURI(uri);
    remoteConfig.update(config);
    config.save();

    Git git1 = new Git(db);
    // create some refs via commits and tag
    RevCommit commit = git1.commit().setMessage("initial commit").call();
    Ref tagRef = git1.tag().setName("tag").call();
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.