cfg.setString(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_SYMLINKS, symLinks.name() .toLowerCase(Locale.ROOT)); File workTree = getWorkTree(); if (!getDirectory().getParentFile().equals(workTree)) { cfg.setString(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_WORKTREE, getWorkTree() .getAbsolutePath());
public void setRemoteLocation(String remoteLocation) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=323571 if (remoteLocation.startsWith("file:/") && !remoteLocation.startsWith("file:///")) { remoteLocation = remoteLocation.replace("file:/", "file:///"); } this.remoteLocation = remoteLocation; if (repository != null) { try { repository.getConfig().setString("remote", "origin", "url", remoteLocation); repository.getConfig().save(); } catch (IOException e) { throw new RuntimeException(e); } } }
/** * Initializes the {@link FileRepository} or creates a new own if it does * not exist. */ private void initRepository() throws IOException { FileRepositoryBuilder builder = new FileRepositoryBuilder(); builder.setWorkTree(localWorkspace); repository = builder.build(); if (!new File(localWorkspace, ".git").isDirectory()) { repository.create(); repository.getConfig().setString("remote", "origin", "fetch", "+refs/heads/*:refs/remotes/origin/*"); repository.getConfig().setString("remote", "origin", "url", remoteLocation); repository.getConfig().setString("branch", watchBranch, "remote", "origin"); repository.getConfig().setString("branch", watchBranch, "merge", "refs/heads/" + watchBranch); repository.getConfig().save(); } }
FileBasedConfig config = repository.getConfig(); for (String branch : Arrays.asList(branchName, "master")) { config.setString("branch", branch, "merge", "refs/heads/" + branch); config.setString("branch", branch, "remote", "origin"); config.setString("remote", "origin", "fetch", "+refs/*:refs/*"); config.setString("remote", "origin", "url", gitUrl); if (!gitDir.exists()) { if (remote) {
cfg.setString(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_SYMLINKS, symLinks.name() .toLowerCase(Locale.ROOT)); File workTree = getWorkTree(); if (!getDirectory().getParentFile().equals(workTree)) { cfg.setString(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_WORKTREE, getWorkTree() .getAbsolutePath());
cfg.setString(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_SYMLINKS, symLinks.name() .toLowerCase()); File workTree = getWorkTree(); if (!getDirectory().getParentFile().equals(workTree)) { cfg.setString(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_WORKTREE, getWorkTree() .getAbsolutePath());