Package org.eclipse.jgit.storage.file

Examples of org.eclipse.jgit.storage.file.FileBasedConfig.save()


      // finished
      reader.release();

      // commit all changes and reset the searcher
      config.setInt(CONF_INDEX, null, CONF_VERSION, INDEX_VERSION);
      config.save();
      writer.commit();
      resetIndexSearcher(model.name);
      result.success();
    } catch (Exception e) {
      logger.error("Exception while reindexing " + model.name, e);
View Full Code Here


        // update the config
        config.setInt(CONF_INDEX, null, CONF_VERSION, INDEX_VERSION);
        config.setString(CONF_ALIAS, null, keyName, branchName);
        config.setString(CONF_BRANCH, null, keyName, branch.getObjectId().getName());
        config.save();
      }

      // the deletedBranches set will normally be empty by this point
      // unless a branch really was deleted and no longer exists
      if (deletedBranches.size() > 0) {
View Full Code Here

      AutoCRLF modeForReset) throws Exception {
    Git git = new Git(db);
    FileBasedConfig config = db.getConfig();
    config.setEnum(ConfigConstants.CONFIG_CORE_SECTION, null,
        ConfigConstants.CONFIG_KEY_AUTOCRLF, modeForCommitting);
    config.save();

    String joinedCrlf = "a\r\nb\r\nc\r\n";
    File trashFile = writeTrashFile("file.txt", joinedCrlf);
    git.add().addFilepattern("file.txt").call();
    RevCommit commit = git.commit().setMessage("create file").call();
View Full Code Here

    // re-create file from the repo
    trashFile.delete();
    config.setEnum(ConfigConstants.CONFIG_CORE_SECTION, null,
        ConfigConstants.CONFIG_KEY_AUTOCRLF, modeForReset);
    config.save();
    git.reset().setMode(ResetType.HARD).call();

    BlameCommand command = new BlameCommand(db);
    command.setFilePath("file.txt");
    BlameResult lines = command.call();
View Full Code Here

        ConfigConstants.CONFIG_KEY_LOGALLREFUPDATES, !bare);
    if (SystemReader.getInstance().isMacOS())
      // Java has no other way
      cfg.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
          ConfigConstants.CONFIG_KEY_PRECOMPOSEUNICODE, true);
    cfg.save();
  }

  /**
   * @return the directory containing the objects owned by this repository.
   */
 
View Full Code Here

  private void setBare(File gitDir, boolean bare) throws IOException,
      ConfigInvalidException {
    FileBasedConfig cfg = configFor(gitDir);
    cfg.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
        ConfigConstants.CONFIG_KEY_BARE, bare);
    cfg.save();
  }

  private void setWorkTree(File gitDir, File workTree)
      throws IOException,
      ConfigInvalidException {
View Full Code Here

      ConfigInvalidException {
    String path = workTree.getAbsolutePath();
    FileBasedConfig cfg = configFor(gitDir);
    cfg.setString(ConfigConstants.CONFIG_CORE_SECTION, null,
        ConfigConstants.CONFIG_KEY_WORKTREE, path);
    cfg.save();
  }

  private FileBasedConfig configFor(File gitDir) throws IOException,
      ConfigInvalidException {
    File configPath = new File(gitDir, Constants.CONFIG);
View Full Code Here

    // Convert the repo to be bare
    FileBasedConfig cfg = repo.getConfig();
    cfg.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
        ConfigConstants.CONFIG_KEY_BARE, true);
    cfg.save();
    Git git = Git.open(repo.getDirectory());
    repo = (FileRepository) git.getRepository();

    // check for the unborn branch master. HEAD should point to master and
    // master doesn't exist.
View Full Code Here

    FileBasedConfig config = db.getConfig();
    config.setBoolean(ConfigConstants.CONFIG_REMOTE_SECTION,
        "origin", "dummy", true);
    config.setBoolean(ConfigConstants.CONFIG_REMOTE_SECTION,
        "ab/c", "dummy", true);
    config.save();
    assertEquals("[ab/c, origin]",
        new TreeSet<String>(db.getRemoteNames()).toString());

    // one-level deep remote branch
    assertEquals("master",
View Full Code Here

    FileBasedConfig userConfig = SystemReader.getInstance().openUserConfig(
        null, git.getRepository().getFS());
    userConfig.setString(ConfigConstants.CONFIG_BRANCH_SECTION, null,
        ConfigConstants.CONFIG_KEY_AUTOSETUPREBASE,
        ConfigConstants.CONFIG_KEY_ALWAYS);
    userConfig.save();
    directory = createTempDirectory("testCloneRepository2");
    command = Git.cloneRepository();
    command.setDirectory(directory);
    command.setURI(fileUri());
    git2 = command.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.