Package org.eclipse.jgit.storage.file

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


            ConfigConstants.CONFIG_KEY_REBASE, false));

    userConfig.setString(ConfigConstants.CONFIG_BRANCH_SECTION, null,
        ConfigConstants.CONFIG_KEY_AUTOSETUPREBASE,
        ConfigConstants.CONFIG_KEY_REMOTE);
    userConfig.save();
    directory = createTempDirectory("testCloneRepository2");
    command = Git.cloneRepository();
    command.setDirectory(directory);
    command.setURI(fileUri());
    git2 = command.call();
View Full Code Here


      modulesConfig.load();
      modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION,
          path, ConfigConstants.CONFIG_KEY_PATH, path);
      modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION,
          path, ConfigConstants.CONFIG_KEY_URL, uri);
      modulesConfig.save();
    } catch (IOException e) {
      throw new JGitInternalException(e.getMessage(), e);
    } catch (ConfigInvalidException e) {
      throw new JGitInternalException(e.getMessage(), e);
    }
View Full Code Here

    modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
        ConfigConstants.CONFIG_KEY_PATH, path);
    String url = "git://server/repo.git";
    modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
        ConfigConstants.CONFIG_KEY_URL, url);
    modulesConfig.save();

    Repository subRepo = Git.cloneRepository()
        .setURI(db.getDirectory().toURI().toString())
        .setDirectory(new File(db.getWorkTree(), path)).call()
        .getRepository();
View Full Code Here

    String base = "git://server/repo.git";
    FileBasedConfig config = db.getConfig();
    config.setString(ConfigConstants.CONFIG_REMOTE_SECTION,
        Constants.DEFAULT_REMOTE_NAME, ConfigConstants.CONFIG_KEY_URL,
        base);
    config.save();

    FileBasedConfig modulesConfig = new FileBasedConfig(new File(
        db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS());
    modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
        ConfigConstants.CONFIG_KEY_PATH, path);
View Full Code Here

    FileBasedConfig config = db.getConfig();

    // Make sure core.autocrlf is false before adding
    config.setEnum(ConfigConstants.CONFIG_CORE_SECTION, null,
        ConfigConstants.CONFIG_KEY_AUTOCRLF, AutoCRLF.FALSE);
    config.save();

    // File is already in repository with CRLF
    writeTrashFile("crlf.txt", "this\r\ncontains\r\ncrlf\r\n");
    git.add().addFilepattern("crlf.txt").call();
    git.commit().setMessage("Add crlf.txt").call();
View Full Code Here

    git.commit().setMessage("Add crlf.txt").call();

    // Now set core.autocrlf to input
    config.setEnum(ConfigConstants.CONFIG_CORE_SECTION, null,
        ConfigConstants.CONFIG_KEY_AUTOCRLF, AutoCRLF.INPUT);
    config.save();

    FileTreeIterator iterator = new FileTreeIterator(db);
    IndexDiff diff = new IndexDiff(db, Constants.HEAD, iterator);
    diff.diff();
View Full Code Here

    modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
        ConfigConstants.CONFIG_KEY_PATH, path);
    String current = "git://server/repo.git";
    modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
        ConfigConstants.CONFIG_KEY_URL, current);
    modulesConfig.save();

    Repository subRepo = Git.cloneRepository()
        .setURI(db.getDirectory().toURI().toString())
        .setDirectory(new File(db.getWorkTree(), path)).call()
        .getRepository();
View Full Code Here

    assertNull(generator.getConfigUrl());
    assertEquals(current, generator.getModulesUrl());

    modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
        ConfigConstants.CONFIG_KEY_URL, "../sub.git");
    modulesConfig.save();

    SubmoduleSyncCommand command = new SubmoduleSyncCommand(db);
    Map<String, String> synced = command.call();
    assertNotNull(synced);
    assertEquals(1, synced.size());
View Full Code Here

        db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS());
    modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION,
        path1, ConfigConstants.CONFIG_KEY_PATH, path1);
    modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION,
        path1, ConfigConstants.CONFIG_KEY_URL, url1);
    modulesConfig.save();

    Git git = new Git(db);
    writeTrashFile("file.txt", "content");
    git.add().addFilepattern("file.txt").call();
    assertNotNull(git.commit().setMessage("create file").call());
View Full Code Here

    FileRepository repo1initial = new FileRepository(new File(repo1Parent,
        Constants.DOT_GIT));
    repo1initial.create();
    final FileBasedConfig cfg = repo1initial.getConfig();
    cfg.setString("core", null, "worktree", workdir.getAbsolutePath());
    cfg.save();
    repo1initial.close();

    File theDir = new File(repo1Parent, Constants.DOT_GIT);
    FileRepository r = (FileRepository) new FileRepositoryBuilder()
        .setGitDir(theDir).build();
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.